Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Assignement_02
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
Alma Berisha
Assignement_02
Commits
09164b6b
Commit
09164b6b
authored
3 weeks ago
by
Alma Berisha
Browse files
Options
Downloads
Patches
Plain Diff
Testfälle für student7 hinzugefügt
parent
1f4b0e1a
Branches
test-student7
Branches containing commit
No related tags found
Loading
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test_me_on_student7.py
+23
-0
23 additions, 0 deletions
test_me_on_student7.py
test_student7_on_me.py
+35
-0
35 additions, 0 deletions
test_student7_on_me.py
with
58 additions
and
0 deletions
test_me_on_student7.py
0 → 100644
+
23
−
0
View file @
09164b6b
import
unittest
from
other.student7.Calculator
import
StringCalculator
# Student 7s Code wird getestet
class
TestMeOnStudent7
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
calc
=
StringCalculator
()
def
test_empty_string
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
""
),
0
)
def
test_custom_delimiter
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
"
//|
\n
1|2|3|4
"
),
10
)
def
test_newlines_and_large_numbers
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
"
1
\n
2,1001
"
),
3
)
def
test_negative_handling
(
self
):
with
self
.
assertRaises
(
ValueError
)
as
context
:
self
.
calc
.
add
(
"
1,-2,-3
"
)
self
.
assertEqual
(
str
(
context
.
exception
),
"
Negatives not allowed: -2, -3
"
)
if
__name__
==
"
__main__
"
:
unittest
.
main
()
This diff is collapsed.
Click to expand it.
test_student7_on_me.py
0 → 100644
+
35
−
0
View file @
09164b6b
import
unittest
from
my_string_calculator
import
StringCalculator
# Hatice und ich hatten den selben code
class
TestStudent7OnMe
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
calc
=
StringCalculator
()
def
test_empty_string
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
""
),
0
)
def
test_single_number
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
"
1
"
),
1
)
def
test_two_numbers
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
"
1,2
"
),
3
)
def
test_multiple_numbers
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
"
1,2,3,4,5
"
),
15
)
def
test_numbers_with_newline
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
"
1
\n
2,3
"
),
6
)
def
test_negative_number
(
self
):
with
self
.
assertRaises
(
ValueError
)
as
e
:
self
.
calc
.
add
(
"
1,-2
"
)
self
.
assertEqual
(
str
(
e
.
exception
),
"
Negatives not allowed: -2
"
)
def
test_custom_delimiter
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
"
//;
\n
1;2
"
),
3
)
def
test_large_numbers_ignored
(
self
):
self
.
assertEqual
(
self
.
calc
.
add
(
"
2,1001
"
),
2
)
if
__name__
==
"
__main__
"
:
unittest
.
main
()
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