diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2018-08-07 06:05:05 -0400 | 
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-08-07 06:05:05 -0400 | 
| commit | b1c2eedd9c4637c4074d62251d532dc2cfe44a64 (patch) | |
| tree | 277701c0ca82d11797502525bac3e3076730a6e5 /tests/test_testing.py | |
| parent | eb52c3a3d8a7e5105f4da78da87a6a629fe9982d (diff) | |
| download | python-coveragepy-git-b1c2eedd9c4637c4074d62251d532dc2cfe44a64.tar.gz | |
assert_file_count
Diffstat (limited to 'tests/test_testing.py')
| -rw-r--r-- | tests/test_testing.py | 17 | 
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")  | 
