Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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
Karen Tracey authored May 04, 2010
30  tests/regressiontests/utils/module_loading.py
@@ -12,16 +12,16 @@ def test_loader(self):
12 12
         test_module = import_module('regressiontests.utils.test_module')
13 13
 
14 14
         # An importable child
15  
-        self.assertTrue(module_has_submodule(test_module, 'good_module'))
  15
+        self.failUnless(module_has_submodule(test_module, 'good_module'))
16 16
         mod = import_module('regressiontests.utils.test_module.good_module')
17 17
         self.assertEqual(mod.content, 'Good Module')
18 18
 
19 19
         # A child that exists, but will generate an import error if loaded
20  
-        self.assertTrue(module_has_submodule(test_module, 'bad_module'))
  20
+        self.failUnless(module_has_submodule(test_module, 'bad_module'))
21 21
         self.assertRaises(ImportError, import_module, 'regressiontests.utils.test_module.bad_module')
22 22
 
23 23
         # A child that doesn't exist
24  
-        self.assertFalse(module_has_submodule(test_module, 'no_such_module'))
  24
+        self.failIf(module_has_submodule(test_module, 'no_such_module'))
25 25
         self.assertRaises(ImportError, import_module, 'regressiontests.utils.test_module.no_such_module')
26 26
 
27 27
 class EggLoader(TestCase):
@@ -39,16 +39,16 @@ def test_shallow_loader(self):
39 39
         egg_module = import_module('egg_module')
40 40
 
41 41
         # An importable child
42  
-        self.assertTrue(module_has_submodule(egg_module, 'good_module'))
  42
+        self.failUnless(module_has_submodule(egg_module, 'good_module'))
43 43
         mod = import_module('egg_module.good_module')
44 44
         self.assertEqual(mod.content, 'Good Module')
45 45
 
46 46
         # A child that exists, but will generate an import error if loaded
47  
-        self.assertTrue(module_has_submodule(egg_module, 'bad_module'))
  47
+        self.failUnless(module_has_submodule(egg_module, 'bad_module'))
48 48
         self.assertRaises(ImportError, import_module, 'egg_module.bad_module')
49 49
 
50 50
         # A child that doesn't exist
51  
-        self.assertFalse(module_has_submodule(egg_module, 'no_such_module'))
  51
+        self.failIf(module_has_submodule(egg_module, 'no_such_module'))
52 52
         self.assertRaises(ImportError, import_module, 'egg_module.no_such_module')
53 53
 
54 54
     def test_deep_loader(self):
@@ -58,16 +58,16 @@ def test_deep_loader(self):
58 58
         egg_module = import_module('egg_module.sub1.sub2')
59 59
 
60 60
         # An importable child
61  
-        self.assertTrue(module_has_submodule(egg_module, 'good_module'))
  61
+        self.failUnless(module_has_submodule(egg_module, 'good_module'))
62 62
         mod = import_module('egg_module.sub1.sub2.good_module')
63 63
         self.assertEqual(mod.content, 'Deep Good Module')
64 64
 
65 65
         # A child that exists, but will generate an import error if loaded
66  
-        self.assertTrue(module_has_submodule(egg_module, 'bad_module'))
  66
+        self.failUnless(module_has_submodule(egg_module, 'bad_module'))
67 67
         self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.bad_module')
68 68
 
69 69
         # A child that doesn't exist
70  
-        self.assertFalse(module_has_submodule(egg_module, 'no_such_module'))
  70
+        self.failIf(module_has_submodule(egg_module, 'no_such_module'))
71 71
         self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.no_such_module')
72 72
 
73 73
 class TestFinder(object):
@@ -107,16 +107,16 @@ def test_shallow_loader(self):
107 107
         egg_module = import_module('egg_module')
108 108
 
109 109
         # An importable child
110  
-        self.assertTrue(module_has_submodule(egg_module, 'good_module'))
  110
+        self.failUnless(module_has_submodule(egg_module, 'good_module'))
111 111
         mod = import_module('egg_module.good_module')
112 112
         self.assertEqual(mod.content, 'Good Module')
113 113
 
114 114
         # A child that exists, but will generate an import error if loaded
115  
-        self.assertTrue(module_has_submodule(egg_module, 'bad_module'))
  115
+        self.failUnless(module_has_submodule(egg_module, 'bad_module'))
116 116
         self.assertRaises(ImportError, import_module, 'egg_module.bad_module')
117 117
 
118 118
         # A child that doesn't exist
119  
-        self.assertFalse(module_has_submodule(egg_module, 'no_such_module'))
  119
+        self.failIf(module_has_submodule(egg_module, 'no_such_module'))
120 120
         self.assertRaises(ImportError, import_module, 'egg_module.no_such_module')
121 121
 
122 122
     def test_deep_loader(self):
@@ -126,14 +126,14 @@ def test_deep_loader(self):
126 126
         egg_module = import_module('egg_module.sub1.sub2')
127 127
 
128 128
         # An importable child
129  
-        self.assertTrue(module_has_submodule(egg_module, 'good_module'))
  129
+        self.failUnless(module_has_submodule(egg_module, 'good_module'))
130 130
         mod = import_module('egg_module.sub1.sub2.good_module')
131 131
         self.assertEqual(mod.content, 'Deep Good Module')
132 132
 
133 133
         # A child that exists, but will generate an import error if loaded
134  
-        self.assertTrue(module_has_submodule(egg_module, 'bad_module'))
  134
+        self.failUnless(module_has_submodule(egg_module, 'bad_module'))
135 135
         self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.bad_module')
136 136
 
137 137
         # A child that doesn't exist
138  
-        self.assertFalse(module_has_submodule(egg_module, 'no_such_module'))
  138
+        self.failIf(module_has_submodule(egg_module, 'no_such_module'))
139 139
         self.assertRaises(ImportError, import_module, 'egg_module.sub1.sub2.no_such_module')

0 notes on commit e28c0ed

Please sign in to comment.
Something went wrong with that request. Please try again.