Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PraxisprojektTechnologiebasierteInnovation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lasse Pikkemaat
PraxisprojektTechnologiebasierteInnovation
Commits
506a816f
Commit
506a816f
authored
1 month ago
by
linopino
Browse files
Options
Downloads
Patches
Plain Diff
1
1
parent
7e42a4d0
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Test.py
+2
-1
2 additions, 1 deletion
Test.py
calculator.py
+29
-0
29 additions, 0 deletions
calculator.py
with
31 additions
and
1 deletion
Test.py
+
2
−
1
View file @
506a816f
print
(
"
Hello WORLD
"
)
\ No newline at end of file
print
(
"
Hello WORLD
"
)
print
(
"
test
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
calculator.py
0 → 100644
+
29
−
0
View file @
506a816f
#Test1: Addition 2 positiver Zaheln (2+5) erwartetes Ergebnis 8
#Test2: Addition negativer und positiver Zahl (-1+1) erwartetes Ergebnis 0
#Test3: Addition (0+0), erwartetes Ergebnis 0
#Test4: Addition von 2 Dezimalzahlen (2,5+3,5), erwartetes Ergebnis 6
from
abc
import
ABC
,
abstractmethod
class
ICalculator
(
ABC
):
@abstractmethod
def
add
(
self
,
a
:
float
,
b
:
float
)
->
float
:
pass
class
Calculator
(
ICalculator
):
def
add
(
self
,
a
:
float
,
b
:
float
)
->
float
:
return
a
+
b
class
TestCalculator
:
def
__init__
(
self
,
calculator
:
ICalculator
):
self
.
calculator
=
calculator
def
test_add
(
self
):
assert
self
.
calculator
.
add
(
2
,
3
)
==
5
,
"
Fehler falls nicht 5
"
assert
self
.
calculator
.
add
(
-
1
,
1
)
==
0
,
"
Fegler falls nich 0
"
assert
self
.
calculator
.
add
(
0
,
0
)
==
0
,
"
Fehler falls nicht 0
"
assert
self
.
calculator
.
add
(
2.5
,
3.5
)
==
6
,
"
Fehler falls nicht 5
"
print
(
"
Test erfolgreich
"
)
if
__name__
==
"
__main__
"
:
calc
=
Calculator
()
tester
=
TestCalculator
(
calc
)
tester
.
test_add
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment