libtbx.tst_python_code_parsing
index
/net/chevy/raid1/nat/src/cctbx_project/libtbx/tst_python_code_parsing.py

 
Functions
       
exercise_old_style_classes()
exercise_unused_imports()
run()

 
Data
        division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
old_style_class_test_case_1 = 'class foo:\n pass\n'
old_style_class_test_case_2 = 'class foo(object):\n pass\n'
old_style_class_test_case_3 = 'class bar:\n pass\n\nclass foo(bar):\n pass\n'
old_style_class_test_case_4 = 'class bar:\n pass\n\nclass foo():\n pass\n'
old_style_class_test_case_5 = 'def bar():\n class foo:\n pass\n'
unused_imports_test_case_10 = 'import bar\n\nclass klass(object):\n\n attr = foo.x\n\n def f(self):\n self.x = bar.z\n\nimport foo\n'
unused_imports_test_case_11 = 'import libtbx.load_env\n\ndef run():\n libtbx.env.build_options.report()\n'
unused_imports_test_case_12 = 'import foo.bar\nprint foo.bar.x\n'
unused_imports_test_case_13 = 'import foo, bar\nprint foo.moo.maz\n'
unused_imports_test_case_14 = 'import foo, bar\nprint foo.moo().moz\n'
unused_imports_test_case_15 = 'import foo, bar\nprint foo.moo[5].moz\n'
unused_imports_test_case_16 = 'from foo import bobar\nprint bobar\n'
unused_imports_test_case_17 = "import foobar\nprint '.'.join(foobar.z)\n"
unused_imports_test_case_18 = 'import foz\ndef faaz(arg=foz.x.yyy):\n pass\n'
unused_imports_test_case_19 = "import foo.barr\nhasattr(foo.barr, 'bok')\n"
unused_imports_test_case_1_1 = 'import foo\nimport far, near as close\nfrom bar im...port barbar, bazbaz as bozboz\nfrom buz import *\n\n'
unused_imports_test_case_1_2 = 'import foo\nimport far, near as close\nfrom bar im... bazbaz as bozboz\nfrom buz import *\n\nprint foo.z\n'
unused_imports_test_case_1_3 = 'import foo\nimport far, near as close\nfrom bar im... bazbaz as bozboz\nfrom buz import *\n\nprint baz.x\n'
unused_imports_test_case_1_4 = 'import foo\nimport far, near as close\nfrom bar im...ozboz\nfrom buz import *\n\nprint foo.z\nprint baz.x\n'
unused_imports_test_case_1_5 = 'import foo\nimport far, near as close\nfrom bar im...azbaz as bozboz\nfrom buz import *\n\nprint foo.baz\n'
unused_imports_test_case_1_header = 'import foo\nimport far, near as close\nfrom bar im...mport barbar, bazbaz as bozboz\nfrom buz import *\n'
unused_imports_test_case_2 = 'import foo\n\ndef f():\n print foo.z\n'
unused_imports_test_case_20 = 'import foo.barr\nclass bokka(kool, foo.barr.klass):\n pass\n'
unused_imports_test_case_21 = 'from foo.bar import bakar\nimport foo.bar.bakar.baaz\n\nprint bakar.baaz\n'
unused_imports_test_case_22 = 'from foo.bar import boz\ndef f():\n print g( boz(q) ).k\n'
unused_imports_test_case_23 = 'from scitbx.array_family import flex # import dependency\n'
unused_imports_test_case_24 = 'from foo.bar import boz\nimport baz.buz\ndef f():\n boz.x = 1\n baz.buz.y = 2\n'
unused_imports_test_case_25 = 'from foo.bar import boz\n\ndef f():\n return g(a=boz.h()).x\n'
unused_imports_test_case_26 = 'from foo.bar import boz\nimport fooo.baz\n\ndef f()...boz.h()].x\n\ndef h():\n return g[fooo.baz.x:1000]\n'
unused_imports_test_case_3 = 'import foo\n\ndef f():\n print bar.foo.z\n'
unused_imports_test_case_4 = 'import bar\n\ndef f():\n import foo\n print bar.foo.z\n'
unused_imports_test_case_5 = 'import bar\n\ndef f():\n import foo\n def g():\n print bar.foo.z\n return g\n'
unused_imports_test_case_6 = 'import bar\n\ndef f():\n import foo\n def g():\n print foo.z\n return g\n'
unused_imports_test_case_7 = 'import bar\n\ndef f():\n def g():\n print foo.z\n import foo\n return g\n'
unused_imports_test_case_7_bis = 'import bar\n\ndef f():\n def g():\n print foo.z\n...ort foo\n def h():\n print foo.y\n return g, h\n'
unused_imports_test_case_8 = 'import foo, bar\n\nclass klass(object):\n\n def f(self):\n self.x = bar.z\n'
unused_imports_test_case_9 = 'import foo, bar\n\nclass klass(object):\n\n attr = foo.x\n\n def f(self):\n self.x = bar.z\n'