Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.1.X] Fixed some Python 2.3 incompatibilities in new tests.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@13093 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e28c0edbeeef3401b1afc2166d68ba0327903ad3 1 parent c7fc889
@kmtracey kmtracey authored
Showing with 15 additions and 15 deletions.
  1. +15 −15 tests/regressiontests/utils/module_loading.py
View
30 tests/regressiontests/utils/module_loading.py
@@ -12,16 +12,16 @@ def test_loader(self):
test_module = import_module('regressiontests.utils.test_module')
# An importable child
- self.assertTrue(module_has_submodule(test_module, 'good_module'))
+ self.failUnless(module_has_submodule(test_module, 'good_module'))
mod = import_module('regressiontests.utils.test_module.good_module')
self.assertEqual(mod.content, 'Good Module')
# A child that exists, but will generate an import error if loaded
- self.assertTrue(module_has_submodule(test_module, 'bad_module'))
+ self.failUnless(module_has_submodule(test_module, 'bad_module'))
self.assertRaises(ImportError, import_module, 'regressiontests.utils.test_module.bad_module')
# A child that doesn't exist
- self.assertFalse(module_has_submodule(test_module, 'no_such_module'))
+ self.failIf(module_has_submodule(test_module, 'no_such_module'))
self.assertRaises(ImportError, import_module, 'regressiontests.utils.test_module.no_such_module')
class EggLoader(TestCase):
@@ -39,16 +39,16 @@ def test_shallow_loader(self):
egg_module = import_module('egg_module')
# An importable child
- self.assertTrue(module_has_submodule(egg_module, 'good_module'))
+ self.failUnless(module_has_submodule(egg_module, 'good_module'))
mod = import_module('egg_module.good_module')
self.assertEqual(mod.content, 'Good Module')
# A child that exists, but will generate an import error if loaded
- self.assertTrue(module_has_submodule(egg_module, 'bad_module'))
+ self.failUnless(module_has_submodule(egg_module, 'bad_module'))
self.assertRaises(ImportError, import_module, 'egg_module.bad_module')
# A child that doesn't exist
- self.assertFalse(module_has_submodule(egg_module, 'no_such_module'))
+ self.failIf(module_has_submodule(egg_module, 'no_such_module'))
self.assertRaises(ImportError, import_module, 'egg_module.no_such_module')
def test_deep_loader(self):
@@ -58,16 +58,16 @@ def test_deep_loader(self):
egg_module = import_module('egg_module.sub1.sub2')
# An importable child
- self.assertTrue(module_has_submodule(egg_module, 'good_module'))
+ self.failUnless(module_has_submodule(egg_module, 'good_module'))
mod = import_module('egg_module.sub1.sub2.good_module')
self.assertEqual(mod.content, 'Deep Good Module')
# A child that exists, but will generate an import error if loaded
- self.assertTrue(module_has_submodule(egg_module, 'bad_module'))
+ self.failUnless(module_has_submodule(egg_module, 'bad_module'))
self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.bad_module')
# A child that doesn't exist
- self.assertFalse(module_has_submodule(egg_module, 'no_such_module'))
+ self.failIf(module_has_submodule(egg_module, 'no_such_module'))
self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.no_such_module')
class TestFinder(object):
@@ -107,16 +107,16 @@ def test_shallow_loader(self):
egg_module = import_module('egg_module')
# An importable child
- self.assertTrue(module_has_submodule(egg_module, 'good_module'))
+ self.failUnless(module_has_submodule(egg_module, 'good_module'))
mod = import_module('egg_module.good_module')
self.assertEqual(mod.content, 'Good Module')
# A child that exists, but will generate an import error if loaded
- self.assertTrue(module_has_submodule(egg_module, 'bad_module'))
+ self.failUnless(module_has_submodule(egg_module, 'bad_module'))
self.assertRaises(ImportError, import_module, 'egg_module.bad_module')
# A child that doesn't exist
- self.assertFalse(module_has_submodule(egg_module, 'no_such_module'))
+ self.failIf(module_has_submodule(egg_module, 'no_such_module'))
self.assertRaises(ImportError, import_module, 'egg_module.no_such_module')
def test_deep_loader(self):
@@ -126,14 +126,14 @@ def test_deep_loader(self):
egg_module = import_module('egg_module.sub1.sub2')
# An importable child
- self.assertTrue(module_has_submodule(egg_module, 'good_module'))
+ self.failUnless(module_has_submodule(egg_module, 'good_module'))
mod = import_module('egg_module.sub1.sub2.good_module')
self.assertEqual(mod.content, 'Deep Good Module')
# A child that exists, but will generate an import error if loaded
- self.assertTrue(module_has_submodule(egg_module, 'bad_module'))
+ self.failUnless(module_has_submodule(egg_module, 'bad_module'))
self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.bad_module')
# A child that doesn't exist
- self.assertFalse(module_has_submodule(egg_module, 'no_such_module'))
+ self.failIf(module_has_submodule(egg_module, 'no_such_module'))
self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.no_such_module')
Please sign in to comment.
Something went wrong with that request. Please try again.