def test_should_find_prefix_module(self): self.assertEqual(autoimport.find_module_for ("ConfigParser.SafeConfigParser"), "ConfigParser") self.assertEqual(autoimport.find_module_for ("xml.etree.ElementTree.parse"), "xml.etree.ElementTree")
def test_should_find_prefix_module(self): self.assertEqual(autoimport.find_module_for ("json.dumps"), "json") self.assertEqual(autoimport.find_module_for ("xml.etree.ElementTree.parse"), "xml.etree.ElementTree")
def test_should_return_none_for_bad_module(self): self.assertIsNone(autoimport.find_module_for("foo")) self.assertIsNone(autoimport.find_module_for("foo.bar"))
def test_should_find_prefix_module(self): self.assertEqual(autoimport.find_module_for("json.dumps"), "json") self.assertEqual( autoimport.find_module_for("xml.etree.ElementTree.parse"), "xml.etree.ElementTree")
def test_should_find_direct_module(self): self.assertEqual(autoimport.find_module_for("json"), "json") self.assertEqual(autoimport.find_module_for("xml.etree"), "xml.etree")
def test_should_find_direct_module(self): self.assertEqual(autoimport.find_module_for("ConfigParser"), "ConfigParser") self.assertEqual(autoimport.find_module_for("xml.etree"), "xml.etree")