summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_fnmatch.py11
-rwxr-xr-xLib/test/test_strftime.py11
2 files changed, 13 insertions, 9 deletions
diff --git a/Lib/test/test_fnmatch.py b/Lib/test/test_fnmatch.py
index abf8811..bde4ee8 100644
--- a/Lib/test/test_fnmatch.py
+++ b/Lib/test/test_fnmatch.py
@@ -11,13 +11,13 @@ class FnmatchTestCase(unittest.TestCase):
def tearDown(self):
_purge()
- def check_match(self, filename, pattern, should_match=1):
+ def check_match(self, filename, pattern, should_match=1, fn=fnmatch):
if should_match:
- self.assertTrue(fnmatch(filename, pattern),
+ self.assertTrue(fn(filename, pattern),
"expected %r to match pattern %r"
% (filename, pattern))
else:
- self.assertTrue(not fnmatch(filename, pattern),
+ self.assertTrue(not fn(filename, pattern),
"expected %r not to match pattern %r"
% (filename, pattern))
@@ -54,6 +54,11 @@ class FnmatchTestCase(unittest.TestCase):
self.assertRaises(TypeError, fnmatchcase, 'test', b'*')
self.assertRaises(TypeError, fnmatchcase, b'test', '*')
+ def test_fnmatchcase(self):
+ check = self.check_match
+ check('AbC', 'abc', 0, fnmatchcase)
+ check('abc', 'AbC', 0, fnmatchcase)
+
def test_bytes(self):
self.check_match(b'test', b'te*')
self.check_match(b'test\xff', b'te*\xff')
diff --git a/Lib/test/test_strftime.py b/Lib/test/test_strftime.py
index 7128fd7..5b94bbe 100755
--- a/Lib/test/test_strftime.py
+++ b/Lib/test/test_strftime.py
@@ -117,16 +117,15 @@ class StrftimeTest(unittest.TestCase):
try:
result = time.strftime(e[0], now)
except ValueError as error:
- print("Standard '%s' format gaver error:" % (e[0], error))
- continue
+ self.fail("strftime '%s' format gave error: %s" % (e[0], error))
if re.match(escapestr(e[1], self.ampm), result):
continue
if not result or result[0] == '%':
- print("Does not support standard '%s' format (%s)" % \
- (e[0], e[2]))
+ self.fail("strftime does not support standard '%s' format (%s)"
+ % (e[0], e[2]))
else:
- print("Conflict for %s (%s):" % (e[0], e[2]))
- print(" Expected %s, but got %s" % (e[1], result))
+ self.fail("Conflict for %s (%s): expected %s, but got %s"
+ % (e[0], e[2], e[1], result))
def strftest2(self, now):
nowsecs = str(int(now))[:-1]