diff options
| author | Robert Bradshaw <robertwb@math.washington.edu> | 2011-01-14 00:31:44 -0800 |
|---|---|---|
| committer | Robert Bradshaw <robertwb@math.washington.edu> | 2011-01-14 00:34:11 -0800 |
| commit | 5f53144925e796bc7a92cf29f86b37e46514acfe (patch) | |
| tree | 88712a1477c6b931c8828f71da1df0389c27fe5a /Cython/Compiler/Tests/TestParseTreeTransforms.py | |
| parent | c5e16a3f5c5964b2e79cc9bc998a33197afed05a (diff) | |
| download | cython-5f53144925e796bc7a92cf29f86b37e46514acfe.tar.gz | |
Undo EOL whitespace additions.
Diffstat (limited to 'Cython/Compiler/Tests/TestParseTreeTransforms.py')
| -rw-r--r-- | Cython/Compiler/Tests/TestParseTreeTransforms.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Cython/Compiler/Tests/TestParseTreeTransforms.py b/Cython/Compiler/Tests/TestParseTreeTransforms.py index 9361de582..77f3a2dd6 100644 --- a/Cython/Compiler/Tests/TestParseTreeTransforms.py +++ b/Cython/Compiler/Tests/TestParseTreeTransforms.py @@ -17,7 +17,7 @@ class TestNormalizeTree(TransformTest): body: ExprStatNode expr: NameNode """, self.treetypes(t)) - + def test_wrap_singlestat(self): t = self.run_pipeline([NormalizeTree(None)], u"if x: y") self.assertLines(u""" @@ -83,7 +83,7 @@ class TestNormalizeTree(TransformTest): stats[0]: ExprStatNode expr: NameNode """, self.treetypes(t)) - + def test_pass_eliminated(self): t = self.run_pipeline([NormalizeTree(None)], u"pass") @@ -142,7 +142,7 @@ class TestWithTransform(object): # (TransformTest): # Disabled! $0_2(None, None, None) """, t) - + # TODO: Re-enable once they're more robust. if sys.version_info[:2] >= (2, 5) and False: @@ -153,15 +153,15 @@ else: DebuggerTestCase = object class TestDebugTransform(DebuggerTestCase): - + def elem_hasattrs(self, elem, attrs): # we shall supporteth python 2.3 ! return all([attr in elem.attrib for attr in attrs]) - + def test_debug_info(self): try: assert os.path.exists(self.debug_dest) - + t = DebugWriter.etree.parse(self.debug_dest) # the xpath of the standard ElementTree is primitive, don't use # anything fancy @@ -171,23 +171,23 @@ class TestDebugTransform(DebuggerTestCase): xml_globals = dict( [(e.attrib['name'], e.attrib['type']) for e in L]) self.assertEqual(len(L), len(xml_globals)) - + L = list(t.find('/Module/Functions')) assert L xml_funcs = dict([(e.attrib['qualified_name'], e) for e in L]) self.assertEqual(len(L), len(xml_funcs)) - + # test globals self.assertEqual('CObject', xml_globals.get('c_var')) self.assertEqual('PythonObject', xml_globals.get('python_var')) - + # test functions - funcnames = ('codefile.spam', 'codefile.ham', 'codefile.eggs', + funcnames = ('codefile.spam', 'codefile.ham', 'codefile.eggs', 'codefile.closure', 'codefile.inner') required_xml_attrs = 'name', 'cname', 'qualified_name' assert all([f in xml_funcs for f in funcnames]) spam, ham, eggs = [xml_funcs[funcname] for funcname in funcnames] - + self.assertEqual(spam.attrib['name'], 'spam') self.assertNotEqual('spam', spam.attrib['cname']) assert self.elem_hasattrs(spam, required_xml_attrs) @@ -199,12 +199,12 @@ class TestDebugTransform(DebuggerTestCase): names = [e.attrib['name'] for e in spam_locals] self.assertEqual(list('abcd'), names) assert self.elem_hasattrs(spam_locals[0], required_xml_attrs) - + # test arguments of functions spam_arguments = list(spam.find('Arguments')) assert spam_arguments self.assertEqual(1, len(list(spam_arguments))) - + # test step-into functions step_into = spam.find('StepIntoFunctions') spam_stepinto = [x.attrib['name'] for x in step_into] @@ -215,10 +215,10 @@ class TestDebugTransform(DebuggerTestCase): except: print open(self.debug_dest).read() raise - - + + if __name__ == "__main__": import unittest |
