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
1a5853fe
Commit
1a5853fe
authored
Dec 13, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for all end* checks
parent
d9a1c58d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
228 additions
and
0 deletions
+228
-0
weblate/trans/tests/test_checks.py
weblate/trans/tests/test_checks.py
+228
-0
No files found.
weblate/trans/tests/test_checks.py
View file @
1a5853fe
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Tests for consistency checks.
"""
...
...
@@ -7,6 +27,9 @@ from weblate.trans.checks import (
SameCheck
,
BeginNewlineCheck
,
EndNewlineCheck
,
BeginSpaceCheck
,
EndSpaceCheck
,
EndStopCheck
,
EndColonCheck
,
EndQuestionCheck
,
EndExclamationCheck
,
EndEllipsisCheck
,
)
...
...
@@ -185,3 +208,208 @@ class EndSpaceCheckTest(TestCase):
Language
(
'cs'
),
None
))
class
EndStopCheckTest
(
TestCase
):
def
setUp
(
self
):
self
.
check
=
EndStopCheck
()
def
test_no_stop
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_stop
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string.'
,
'string.'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_stop_1
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string.'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_stop_2
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string'
,
'string.'
,
''
,
Language
(
'cs'
),
None
))
class
EndColonCheckTest
(
TestCase
):
def
setUp
(
self
):
self
.
check
=
EndColonCheck
()
def
test_no_colon
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_colon
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string:'
,
'string:'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_colon_1
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string:'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_colon_2
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string'
,
'string:'
,
''
,
Language
(
'cs'
),
None
))
class
EndQuestionCheckTest
(
TestCase
):
def
setUp
(
self
):
self
.
check
=
EndQuestionCheck
()
def
test_no_question
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_question
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string?'
,
'string?'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_question_1
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string?'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_question_2
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string'
,
'string?'
,
''
,
Language
(
'cs'
),
None
))
class
EndExclamationCheckTest
(
TestCase
):
def
setUp
(
self
):
self
.
check
=
EndExclamationCheck
()
def
test_no_exclamation
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_exclamation
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string!'
,
'string!'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_exclamation_1
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string!'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_exclamation_2
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string'
,
'string!'
,
''
,
Language
(
'cs'
),
None
))
class
EndEllipsisCheckTest
(
TestCase
):
def
setUp
(
self
):
self
.
check
=
EndEllipsisCheck
()
def
test_no_ellipsis
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
'string'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_ellipsis
(
self
):
self
.
assertFalse
(
self
.
check
.
check_single
(
u'string…'
,
u'string…'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_ellipsis_1
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
u'string…'
,
'string'
,
''
,
Language
(
'cs'
),
None
))
def
test_missing_ellipsis_2
(
self
):
self
.
assertTrue
(
self
.
check
.
check_single
(
'string'
,
u'string…'
,
''
,
Language
(
'cs'
),
None
))
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