Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
08b3f83f
Commit
08b3f83f
authored
Jan 23, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify checks testing
parent
e9190a55
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
414 deletions
+111
-414
weblate/trans/tests/__init__.py
weblate/trans/tests/__init__.py
+1
-0
weblate/trans/tests/test_chars_checks.py
weblate/trans/tests/test_chars_checks.py
+58
-412
weblate/trans/tests/test_checks.py
weblate/trans/tests/test_checks.py
+52
-2
No files found.
weblate/trans/tests/__init__.py
View file @
08b3f83f
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#
#
from
weblate.trans.tests.test_diff
import
*
from
weblate.trans.tests.test_diff
import
*
from
weblate.trans.tests.test_checks
import
*
from
weblate.trans.tests.test_format_checks
import
*
from
weblate.trans.tests.test_format_checks
import
*
from
weblate.trans.tests.test_chars_checks
import
*
from
weblate.trans.tests.test_chars_checks
import
*
from
weblate.trans.tests.test_same_checks
import
*
from
weblate.trans.tests.test_same_checks
import
*
...
...
weblate/trans/tests/test_chars_checks.py
View file @
08b3f83f
This diff is collapsed.
Click to expand it.
weblate/trans/tests/test_checks.py
View file @
08b3f83f
...
@@ -22,12 +22,17 @@
...
@@ -22,12 +22,17 @@
Helpers for quality checks tests.
Helpers for quality checks tests.
"""
"""
from
django.test
import
TestCase
import
uuid
import
unittest
from
weblate.trans.checks.base
import
Check
class
Language
(
object
):
class
Language
(
object
):
'''
'''
Mock language object.
Mock language object.
'''
'''
def
__init__
(
self
,
code
):
def
__init__
(
self
,
code
=
'cs'
):
self
.
code
=
code
self
.
code
=
code
...
@@ -35,5 +40,50 @@ class Unit(object):
...
@@ -35,5 +40,50 @@ class Unit(object):
'''
'''
Mock unit object.
Mock unit object.
'''
'''
def
__init__
(
self
,
checksum
):
def
__init__
(
self
,
checksum
=
None
):
if
checksum
is
None
:
checksum
=
str
(
uuid
.
uuid1
())
self
.
checksum
=
checksum
self
.
checksum
=
checksum
class
CheckTestCase
(
TestCase
):
'''
Generic test, also serves for testing base class.
'''
def
setUp
(
self
):
self
.
check
=
Check
()
self
.
test_empty
=
(
''
,
''
,
''
)
self
.
test_good_1
=
(
''
,
''
,
''
)
self
.
test_good_2
=
(
'string'
,
'string'
,
''
)
self
.
test_failure_1
=
None
self
.
test_failure_2
=
None
def
do_test
(
self
,
expected
,
data
):
if
data
is
None
:
return
self
.
assertEqual
(
self
.
check
.
check_single
(
data
[
0
],
data
[
1
],
data
[
1
],
Language
(),
Unit
(),
0
),
expected
)
def
test_single_good_1
(
self
):
self
.
do_test
(
False
,
self
.
test_good_1
)
def
test_single_good_2
(
self
):
self
.
do_test
(
False
,
self
.
test_good_2
)
def
test_single_empty
(
self
):
self
.
do_test
(
False
,
self
.
test_empty
)
def
test_single_failure_1
(
self
):
self
.
do_test
(
True
,
self
.
test_failure_1
)
def
test_single_failure_2
(
self
):
self
.
do_test
(
True
,
self
.
test_failure_2
)
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