summaryrefslogtreecommitdiff
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-08-07 06:05:05 -0400
committerNed Batchelder <ned@nedbatchelder.com>2018-08-07 06:05:05 -0400
commitb1c2eedd9c4637c4074d62251d532dc2cfe44a64 (patch)
tree277701c0ca82d11797502525bac3e3076730a6e5 /tests/test_testing.py
parenteb52c3a3d8a7e5105f4da78da87a6a629fe9982d (diff)
downloadpython-coveragepy-git-b1c2eedd9c4637c4074d62251d532dc2cfe44a64.tar.gz
assert_file_count
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r--tests/test_testing.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py
index d8cd0ef0..2b01584e 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -51,6 +51,23 @@ class CoverageTestTest(CoverageTest):
with self.assertRaises(AssertionError):
self.assert_exists("shadow.txt")
+ def test_file_count(self):
+ self.make_file("abcde.txt", "abcde")
+ self.make_file("axczz.txt", "axczz")
+ self.make_file("afile.txt", "afile")
+ self.assert_file_count("a*.txt", 3)
+ self.assert_file_count("*c*.txt", 2)
+ self.assert_file_count("afile.*", 1)
+ self.assert_file_count("*.q", 0)
+ with self.assertRaises(AssertionError):
+ self.assert_file_count("a*.txt", 13)
+ with self.assertRaises(AssertionError):
+ self.assert_file_count("*c*.txt", 12)
+ with self.assertRaises(AssertionError):
+ self.assert_file_count("afile.*", 11)
+ with self.assertRaises(AssertionError):
+ self.assert_file_count("*.q", 10)
+
def test_assert_startwith(self):
self.assert_starts_with("xyzzy", "xy")
self.assert_starts_with("xyz\nabc", "xy")