diff options
author | Fabrice Douchant <Fabrice.Douchant@logilab.fr> | 2008-10-21 12:26:40 +0200 |
---|---|---|
committer | Fabrice Douchant <Fabrice.Douchant@logilab.fr> | 2008-10-21 12:26:40 +0200 |
commit | 25b9cdf5f6e72c7c8aec5ef927cf67ee1a0eeda4 (patch) | |
tree | 9adb0e299cde27aafa7dd53529e1d6878fc79809 | |
parent | e0d49d01c92fd532363bde94cadf428dc9b91ec3 (diff) | |
download | logilab-common-25b9cdf5f6e72c7c8aec5ef927cf67ee1a0eeda4.tar.gz |
move tests on decorators require_version require_module into DecoratorTC TestCase instead of having two decorator's testing classes (DecoratorTC and DecoratorsTC).
-rw-r--r-- | test/unittest_testlib.py | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/test/unittest_testlib.py b/test/unittest_testlib.py index 93f4490..afdf932 100644 --- a/test/unittest_testlib.py +++ b/test/unittest_testlib.py @@ -670,44 +670,6 @@ class DecoratorTC(TestCase): self.assertListEquals(list(os.walk(tempdir)), [(tempdir,[],[])]) -class TagTC(TestCase): - - def setUp(self): - @tag('testing', 'bob') - def bob(a, b, c): - return (a + b) * c - - self.func = bob - - def test_tag_decorator(self): - bob = self.func - - self.assertEquals(bob(2, 3, 7), 35) - self.assertTrue(hasattr(bob, 'tags')) - self.assertSetEquals(bob.tags, set(['testing','bob'])) - - - def test_tags_class(self): - tags = self.func.tags - - self.assertTrue(tags['testing']) - self.assertFalse(tags['Not inside']) - - def test_tags_match(self): - tags = self.func.tags - - self.assertTrue(tags.match('testing')) - self.assertFalse(tags.match('other')) - - self.assertFalse(tags.match('testing and coin')) - self.assertTrue(tags.match('testing or other')) - - self.assertTrue(tags.match('not other')) - - self.assertTrue(tags.match('not other or (testing and bibi)')) - self.assertTrue(tags.match('other or (testing and bob)')) - -class DecoratorsTC(TestCase): def test_require_version_good(self): """ should return the same function """ @@ -775,6 +737,43 @@ class DecoratorsTC(TestCase): print 'all modules in %s exist. Could not test %s' % (', '.join(modules), sys._getframe().f_code.co_name) +class TagTC(TestCase): + + def setUp(self): + @tag('testing', 'bob') + def bob(a, b, c): + return (a + b) * c + + self.func = bob + + def test_tag_decorator(self): + bob = self.func + + self.assertEquals(bob(2, 3, 7), 35) + self.assertTrue(hasattr(bob, 'tags')) + self.assertSetEquals(bob.tags, set(['testing','bob'])) + + + def test_tags_class(self): + tags = self.func.tags + + self.assertTrue(tags['testing']) + self.assertFalse(tags['Not inside']) + + def test_tags_match(self): + tags = self.func.tags + + self.assertTrue(tags.match('testing')) + self.assertFalse(tags.match('other')) + + self.assertFalse(tags.match('testing and coin')) + self.assertTrue(tags.match('testing or other')) + + self.assertTrue(tags.match('not other')) + + self.assertTrue(tags.match('not other or (testing and bibi)')) + self.assertTrue(tags.match('other or (testing and bob)')) + if __name__ == '__main__': unittest_main() |