Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
0951345e
Commit
0951345e
authored
Nov 15, 2015
by
Alison Winters
Browse files
Options
Downloads
Patches
Plain Diff
add some unit tests for exceptions helper
parent
7dce8f8e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/exceptions_helper_tests.py
+42
-0
42 additions, 0 deletions
tests/exceptions_helper_tests.py
with
42 additions
and
0 deletions
tests/exceptions_helper_tests.py
0 → 100644
+
42
−
0
View file @
0951345e
# -*- coding: utf-8 -*-
import
sys
,
os
.
path
sys
.
path
.
insert
(
1
,
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
../lib
'
)))
sys
.
path
.
insert
(
1
,
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
..
'
)))
import
unittest
import
test_lib
as
test
from
sickrage.helper.exceptions
import
ex
class
ExceptionsHelperTestCase
(
unittest
.
TestCase
):
def
test_none_returns_empty
(
self
):
self
.
assertEqual
(
ex
(
None
),
u
''
)
def
test_empty_args_returns_empty
(
self
):
self
.
assertEqual
(
ex
(
Exception
()),
u
''
)
def
test_args_of_none_returns_empty
(
self
):
self
.
assertEqual
(
ex
(
Exception
(
None
,
None
)),
u
''
)
def
test_Exception_returns_args_string
(
self
):
self
.
assertEqual
(
ex
(
Exception
(
'
hi
'
)),
'
hi
'
)
# TODO why doesn't this work?
# def test_Exception_returns_args_ustring(self):
# self.assertEqual(ex(Exception('\xc3\xa4h')), u'äh')
def
test_Exception_returns_concatenated_args_strings
(
self
):
self
.
assertEqual
(
ex
(
Exception
(
'
lots
'
,
'
of
'
,
'
strings
'
)),
'
lots : of : strings
'
)
def
test_Exception_returns_stringified_args
(
self
):
self
.
assertEqual
(
ex
(
Exception
(
303
)),
'
error 303
'
)
if
__name__
==
'
__main__
'
:
if
len
(
sys
.
argv
)
>
1
:
suite
=
unittest
.
TestLoader
().
loadTestsFromName
(
'
exceptions_helper_tests.ExceptionsHelperTestCase.test_
'
+
sys
.
argv
[
1
])
unittest
.
TextTestRunner
(
verbosity
=
2
).
run
(
suite
)
else
:
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
ExceptionsHelperTestCase
)
unittest
.
TextTestRunner
(
verbosity
=
2
).
run
(
suite
)
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
sign in
to comment