Ejemplo n.º 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"))
Ejemplo n.º 2
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"))
Ejemplo n.º 3
0
 def test_should_add_imports_at_beginning_of_empty_file(self):
     self.assertEqual(autoimport.add_imports("", ["foo", "bar"]),
                      "import foo\nimport bar\n")
Ejemplo n.º 4
0
 def test_should_add_imports_at_beginning_of_empty_file(self):
     self.assertEqual(autoimport.add_imports("", ["foo", "bar"]),
                      "import foo\nimport bar\n")