diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-04-11 10:44:35 +0200 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-04-11 10:44:35 +0200 |
commit | 074b6e8f12af8462de902ab988c37f8852a450cf (patch) | |
tree | f1000db5900d94d057773875d515e804a8c9810f /test | |
parent | 6051b5918c3d1d7120f3d546410c937c3a2b0c09 (diff) | |
download | logilab-common-074b6e8f12af8462de902ab988c37f8852a450cf.tar.gz |
[modutils test] simplify test names and add border cases test for is_standard_module
Diffstat (limited to 'test')
-rw-r--r-- | test/unittest_modutils.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/test/unittest_modutils.py b/test/unittest_modutils.py index 2218da5..3e9a74a 100644 --- a/test/unittest_modutils.py +++ b/test/unittest_modutils.py @@ -185,7 +185,7 @@ class is_standard_module_tc(ModutilsTestCase): library """ - def test_knownValues_is_standard_module_builtins(self): + def test_builtins(self): if sys.version_info < (3, 0): self.assertEqual(modutils.is_standard_module('__builtin__'), True) self.assertEqual(modutils.is_standard_module('builtins'), False) @@ -193,16 +193,16 @@ class is_standard_module_tc(ModutilsTestCase): self.assertEqual(modutils.is_standard_module('__builtin__'), False) self.assertEqual(modutils.is_standard_module('builtins'), True) - def test_knownValues_is_standard_module_builtin(self): + def test_builtin(self): self.assertEqual(modutils.is_standard_module('sys'), True) - def test_knownValues_is_standard_module_nonstandard(self): + def test_nonstandard(self): self.assertEqual(modutils.is_standard_module('logilab'), False) - def test_knownValues_is_standard_module_unknown(self): + def test_unknown(self): self.assertEqual(modutils.is_standard_module('unknown'), False) - def test_knownValues_is_standard_module_4(self): + def test_4(self): self.assertEqual(modutils.is_standard_module('marshal'), True) self.assertEqual(modutils.is_standard_module('hashlib'), True) self.assertEqual(modutils.is_standard_module('pickle'), True) @@ -210,10 +210,20 @@ class is_standard_module_tc(ModutilsTestCase): self.assertEqual(modutils.is_standard_module('io'), sys.version_info >= (2, 6)) self.assertEqual(modutils.is_standard_module('StringIO'), sys.version_info < (3, 0)) - def test_knownValues_is_standard_module_custom_path(self): + def test_custom_path(self): self.assertEqual(modutils.is_standard_module('data.module', (DATADIR,)), True) self.assertEqual(modutils.is_standard_module('data.module', (path.abspath(DATADIR),)), True) + def test_failing_border_cases(self): + # using a subpackage/submodule path as std_path argument + self.assertEqual(modutils.is_standard_module('logilab.common', common.__path__), False) + # using a module + object name as modname argument + self.assertEqual(modutils.is_standard_module('sys.path'), True) + # this is because only the first package/module is considered + self.assertEqual(modutils.is_standard_module('sys.whatever'), True) + self.assertEqual(modutils.is_standard_module('logilab.whatever', common.__path__), False) + + class is_relative_tc(ModutilsTestCase): |