Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
swc-bb
S
swc-templates
S
swc-lessons
Software Publishing
Astronaut Analysis
Commits
570c98ca
Commit
570c98ca
authored
Jul 13, 2020
by
Maximilian Dolling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added unittests to ci; added test unittests
parent
82dbecf5
Pipeline
#10094
passed with stage
in 1 minute and 6 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
0 deletions
+87
-0
.gitlab-ci.yml
.gitlab-ci.yml
+9
-0
test/unittest/test_data_types.py
test/unittest/test_data_types.py
+39
-0
test/unittest/test_file_io.py
test/unittest/test_file_io.py
+39
-0
No files found.
.gitlab-ci.yml
View file @
570c98ca
...
...
@@ -16,3 +16,12 @@ test:pylint:
-
"
**/*.py"
-
"
test/linting/pylintrc"
-
"
.gitlab-ci.yml"
test:unittest:
stage
:
test
script
:
-
pipenv run python -m unittest discover test/unittest
only
:
changes
:
-
"
**/*.py"
-
"
.gitlab-ci.yml"
test/unittest/test_data_types.py
0 → 100644
View file @
570c98ca
import
unittest
class
TestStringMethods
(
unittest
.
TestCase
):
def
test_upper
(
self
):
self
.
assertEqual
(
'foo'
.
upper
(),
'FOO'
)
def
test_isupper
(
self
):
self
.
assertTrue
(
'FOO'
.
isupper
())
self
.
assertFalse
(
'Foo'
.
isupper
())
def
test_split
(
self
):
s
=
'hello world'
self
.
assertEqual
(
s
.
split
(),
[
'hello'
,
'world'
])
# check that s.split fails when the separator is not a string
with
self
.
assertRaises
(
TypeError
):
s
.
split
(
2
)
class
TestStringMethods2
(
unittest
.
TestCase
):
def
test_upper
(
self
):
self
.
assertEqual
(
'foo'
.
upper
(),
'FOO'
)
def
test_isupper
(
self
):
self
.
assertTrue
(
'FOO'
.
isupper
())
self
.
assertFalse
(
'Foo'
.
isupper
())
def
test_split
(
self
):
s
=
'hello world'
self
.
assertEqual
(
s
.
split
(),
[
'hello'
,
'world'
])
# check that s.split fails when the separator is not a string
with
self
.
assertRaises
(
TypeError
):
s
.
split
(
2
)
if
__name__
==
'__main__'
:
unittest
.
main
()
test/unittest/test_file_io.py
0 → 100644
View file @
570c98ca
import
unittest
class
TestStringMethods
(
unittest
.
TestCase
):
def
test_upper
(
self
):
self
.
assertEqual
(
'foo'
.
upper
(),
'FOO'
)
def
test_isupper
(
self
):
self
.
assertTrue
(
'FOO'
.
isupper
())
self
.
assertFalse
(
'Foo'
.
isupper
())
def
test_split
(
self
):
s
=
'hello world'
self
.
assertEqual
(
s
.
split
(),
[
'hello'
,
'world'
])
# check that s.split fails when the separator is not a string
with
self
.
assertRaises
(
TypeError
):
s
.
split
(
2
)
class
TestStringMethods2
(
unittest
.
TestCase
):
def
test_upper
(
self
):
self
.
assertEqual
(
'foo'
.
upper
(),
'FOO'
)
def
test_isupper
(
self
):
self
.
assertTrue
(
'FOO'
.
isupper
())
self
.
assertFalse
(
'Foo'
.
isupper
())
def
test_split
(
self
):
s
=
'hello world'
self
.
assertEqual
(
s
.
split
(),
[
'hello'
,
'world'
])
# check that s.split fails when the separator is not a string
with
self
.
assertRaises
(
TypeError
):
s
.
split
(
2
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment