diff options
author | Kumar McMillan <kumar.mcmillan@gmail.com> | 2008-03-06 15:24:27 +0000 |
---|---|---|
committer | Kumar McMillan <kumar.mcmillan@gmail.com> | 2008-03-06 15:24:27 +0000 |
commit | 97f42abc29168cb15a112f73925bd04528131728 (patch) | |
tree | 3276849ed440287708f8c79da769f2bef6fbff9e /unit_tests/test_utils.py | |
parent | 86adc5307b61690bab311f1ca5840a6bdf502da7 (diff) | |
download | nose-97f42abc29168cb15a112f73925bd04528131728.tar.gz |
merged Ticket-153 branch into trunk, -r433:HEAD . This fixes bugs in metaclass support when nose is discovering tests.
Diffstat (limited to 'unit_tests/test_utils.py')
-rw-r--r-- | unit_tests/test_utils.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/unit_tests/test_utils.py b/unit_tests/test_utils.py index f982cc2..ede573a 100644 --- a/unit_tests/test_utils.py +++ b/unit_tests/test_utils.py @@ -99,6 +99,33 @@ class TestUtils(unittest.TestCase): (me, __name__, 'baz')) self.assertEqual(test_address(foo_mtc), (me, __name__, 'Foo.bar')) + + def test_isclass_detects_classes(self): + class TC(unittest.TestCase): + pass + class TC_Classic: + pass + class TC_object(object): + pass + # issue153 -- was not detecting custom typed classes... + class TCType(type): + pass + class TC_custom_type(object): + __metaclass__ = TCType + class TC_unittest_custom_type(unittest.TestCase): + __metaclass__ = TCType + + assert util.isclass(TC), "failed to detect %s as class" % TC + assert util.isclass(TC_Classic), "failed to detect %s as class" % TC_Classic + assert util.isclass(TC_object), "failed to detect %s as class" % TC_object + assert util.isclass(TC_custom_type), "failed to detect %s as class" % TC_custom_type + assert util.isclass(TC_unittest_custom_type), "failed to detect %s as class" % TC_unittest_custom_type + + def test_isclass_ignores_nonclass_things(self): + anint = 1 + adict = {} + assert not util.isclass(anint), "should have ignored %s" % type(anint) + assert not util.isclass(adict), "should have ignored %s" % type(adict) def test_tolist(self): tolist = util.tolist |