Vorbereitung für PVL
parent
4479a3339f
commit
828937930f
|
|
@ -6,6 +6,8 @@ ARG USERNAME=vscode
|
||||||
ARG USER_UID=1000
|
ARG USER_UID=1000
|
||||||
ARG USER_GID=$USER_UID
|
ARG USER_GID=$USER_UID
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir pytest black
|
||||||
|
|
||||||
RUN groupadd --gid $USER_GID $USERNAME && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
|
RUN groupadd --gid $USER_GID $USERNAME && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
|
||||||
USER $USERNAME
|
USER $USERNAME
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,21 @@
|
||||||
{
|
{
|
||||||
"name": "Python 3.11 Dev Container",
|
"name": "Python 3.11 Dev Container",
|
||||||
"dockerFile": "Dockerfile",
|
"image": "dev-test-image:latest",
|
||||||
|
//"dockerFile": "Dockerfile",
|
||||||
"mounts": [
|
"mounts": [
|
||||||
"source=${localWorkspaceFolder},target=/workspace,type=bind"
|
"source=${localWorkspaceFolder},target=/workspace,type=bind"
|
||||||
],
|
],
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
"settings": {
|
"settings": {
|
||||||
|
// Testing: Pytest-Erkennung aktivieren
|
||||||
|
"python.testing.pytestEnabled": true,
|
||||||
|
"python.testing.pytestArgs": [
|
||||||
|
"."
|
||||||
|
],
|
||||||
|
|
||||||
"python.linting.enabled": true,
|
"python.linting.enabled": true,
|
||||||
"python.linting.pylintEnabled": true,
|
"python.linting.pylintEnabled": true,
|
||||||
"python.formatting.provider": "black"
|
"python.formatting.provider": "black"
|
||||||
|
|
@ -12,8 +23,9 @@
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"ms-python.python",
|
"ms-python.python",
|
||||||
"ms-python.vscode-pylance"
|
"ms-python.vscode-pylance"
|
||||||
],
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"postCreateCommand": "pip install --upgrade pip && pip install pytest black",
|
"postCreateCommand": "pip install --upgrade pip"
|
||||||
"remoteUser": "vscode"
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1,26 +0,0 @@
|
||||||
# Datei: test_sum_calculator.py
|
|
||||||
|
|
||||||
from sum_calculator import calculate_cumulative_sum
|
|
||||||
|
|
||||||
def test_sum_for_zero():
|
|
||||||
"""Testet den Randfall, wenn die Obergrenze 0 ist."""
|
|
||||||
# Arrange: Testdaten
|
|
||||||
limit = 0
|
|
||||||
# Act: Funktion aufrufen
|
|
||||||
result = calculate_cumulative_sum(limit)
|
|
||||||
# Assert: Überprüfen des Ergebnisses (0 erwartet)
|
|
||||||
assert result == 0
|
|
||||||
|
|
||||||
def test_sum_for_five():
|
|
||||||
"""Testet den allgemeinen Fall für die Zahl 5 (0+1+2+3+4+5 = 15)."""
|
|
||||||
# Arrange: Testdaten
|
|
||||||
limit = 5
|
|
||||||
# Act: Funktion aufrufen
|
|
||||||
result = calculate_cumulative_sum(limit)
|
|
||||||
# Assert: Überprüfen des Ergebnisses (15 erwartet)
|
|
||||||
assert result == 15
|
|
||||||
|
|
||||||
def test_sum_is_correct_type():
|
|
||||||
"""Testet, ob die Funktion einen Integer zurückgibt."""
|
|
||||||
# Arrange, Act, Assert
|
|
||||||
assert isinstance(calculate_cumulative_sum(3), int)
|
|
||||||
Loading…
Reference in New Issue