diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-03-04 03:12:35 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-03-04 18:02:06 +0100 |
commit | 7a614ac7104cc59f6af70de1b0ba3eee472c3c21 (patch) | |
tree | f473d18e7b66b0ff32c779ae3064806db861fa8a /selftest/tests | |
parent | 8b583dc64cc0510b4b8d64086ea72b2502249350 (diff) | |
download | samba-7a614ac7104cc59f6af70de1b0ba3eee472c3c21.tar.gz samba-7a614ac7104cc59f6af70de1b0ba3eee472c3c21.tar.bz2 samba-7a614ac7104cc59f6af70de1b0ba3eee472c3c21.zip |
selftest.testlist: Add read_test_regexes.
Diffstat (limited to 'selftest/tests')
-rw-r--r-- | selftest/tests/test_testlist.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/selftest/tests/test_testlist.py b/selftest/tests/test_testlist.py index e62300cace..5f03887b4e 100644 --- a/selftest/tests/test_testlist.py +++ b/selftest/tests/test_testlist.py @@ -21,8 +21,11 @@ from selftest.testlist import ( find_in_list, + read_test_regexes, ) +from cStringIO import StringIO + import unittest @@ -34,3 +37,19 @@ class FindInListTests(unittest.TestCase): def test_no_reason(self): self.assertEquals("because", find_in_list([("foo.*bar", "because")], "foo.bla.bar")) + + +class ReadTestRegexesTests(unittest.TestCase): + + def test_comment(self): + f = StringIO("# I am a comment\n # I am also a comment\n") + self.assertEquals([], list(read_test_regexes(f))) + + def test_no_reason(self): + f = StringIO(" foo\n") + self.assertEquals([("foo", None)], list(read_test_regexes(f))) + + def test_reason(self): + f = StringIO(" foo # because\nbar\n") + self.assertEquals([("foo", "because"), ("bar", None)], + list(read_test_regexes(f))) |