Skip to content

Commit

Permalink
reworked _run_failure_tests()
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder committed Feb 22, 2017
1 parent 23b377f commit 4227c05
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Tests/t_ldap_schema_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
TESTCASES_BROKEN = (
"( BLUB",
"BLUB )",
"( BLUB )) DA (",
"BLUB 'DA",
r"BLUB 'DA\'",
"BLUB $ DA",
"BLUB 'DA\\'",
"( BLUB )) DA (",
)

class TestSplitTokens(unittest.TestCase):
Expand All @@ -70,12 +70,20 @@ def _run_split_tokens_tests(self, test_cases):

def _run_failure_tests(self, test_cases):
for test_value in test_cases:
should_have_failed = []
try:
_ = ldap.schema.split_tokens(test_value)
except ValueError:
pass
else:
self.fail('%r should have raised ValueError' % (test_value))
should_have_failed.append(test_value)
if should_have_failed:
self.fail(
'%d value(s) should have raised ValueError: %r' % (
len(should_have_failed),
should_have_failed,
)
)

def test_basic(self):
"""
Expand Down

0 comments on commit 4227c05

Please sign in to comment.