Пример #1
0
 def test_should_add_imports_at_end_of_existing_imports(self):
     source = ("import x\n"
               "import y\n"
               "\n"
               "meep.meep()\n")
     self.assertEqual(autoimport.add_imports(source, ["foo", "bar"]),
                      ("import x\n"
                       "import y\n"
                       "import foo\n"
                       "import bar\n"
                       "\n"
                       "meep.meep()\n"))
Пример #2
0
 def test_should_add_imports_at_beginning_of_empty_file(self):
     self.assertEqual(autoimport.add_imports("", ["foo", "bar"]),
                      "import foo\nimport bar\n")