Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(253315)

Side by Side Diff: Lib/test/test_symtable.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_strptime.py ('k') | Lib/test/test_sysconfig.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """ 1 """
2 Test the API of the symtable module. 2 Test the API of the symtable module.
3 """ 3 """
4 import symtable 4 import symtable
5 import unittest 5 import unittest
6 6
7 from test import support 7 from test import support
8 8
9 9
10 TEST_CODE = """ 10 TEST_CODE = """
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 self.assertRaises(KeyError, self.top.lookup, "not_here") 115 self.assertRaises(KeyError, self.top.lookup, "not_here")
116 116
117 def test_namespaces(self): 117 def test_namespaces(self):
118 self.assertTrue(self.top.lookup("Mine").is_namespace()) 118 self.assertTrue(self.top.lookup("Mine").is_namespace())
119 self.assertTrue(self.Mine.lookup("a_method").is_namespace()) 119 self.assertTrue(self.Mine.lookup("a_method").is_namespace())
120 self.assertTrue(self.top.lookup("spam").is_namespace()) 120 self.assertTrue(self.top.lookup("spam").is_namespace())
121 self.assertTrue(self.spam.lookup("internal").is_namespace()) 121 self.assertTrue(self.spam.lookup("internal").is_namespace())
122 self.assertTrue(self.top.lookup("namespace_test").is_namespace()) 122 self.assertTrue(self.top.lookup("namespace_test").is_namespace())
123 self.assertFalse(self.spam.lookup("x").is_namespace()) 123 self.assertFalse(self.spam.lookup("x").is_namespace())
124 124
125 self.assertTrue(self.top.lookup("spam").get_namespace() is self.spam) 125 self.assertIs(self.top.lookup("spam").get_namespace(), self.spam)
126 ns_test = self.top.lookup("namespace_test") 126 ns_test = self.top.lookup("namespace_test")
127 self.assertEqual(len(ns_test.get_namespaces()), 2) 127 self.assertEqual(len(ns_test.get_namespaces()), 2)
128 self.assertRaises(ValueError, ns_test.get_namespace) 128 self.assertRaises(ValueError, ns_test.get_namespace)
129 129
130 def test_assigned(self): 130 def test_assigned(self):
131 self.assertTrue(self.spam.lookup("x").is_assigned()) 131 self.assertTrue(self.spam.lookup("x").is_assigned())
132 self.assertTrue(self.spam.lookup("bar").is_assigned()) 132 self.assertTrue(self.spam.lookup("bar").is_assigned())
133 self.assertTrue(self.top.lookup("spam").is_assigned()) 133 self.assertTrue(self.top.lookup("spam").is_assigned())
134 self.assertTrue(self.Mine.lookup("a_method").is_assigned()) 134 self.assertTrue(self.Mine.lookup("a_method").is_assigned())
135 self.assertFalse(self.internal.lookup("x").is_assigned()) 135 self.assertFalse(self.internal.lookup("x").is_assigned())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 def test_exec(self): 168 def test_exec(self):
169 symbols = symtable.symtable("def f(x): return x", "?", "exec") 169 symbols = symtable.symtable("def f(x): return x", "?", "exec")
170 170
171 171
172 def test_main(): 172 def test_main():
173 support.run_unittest(SymtableTest) 173 support.run_unittest(SymtableTest)
174 174
175 if __name__ == '__main__': 175 if __name__ == '__main__':
176 test_main() 176 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_strptime.py ('k') | Lib/test/test_sysconfig.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+