def test_import_object_required_arg_present(self):
     obj = importutils.import_object('oslo_utils.tests.fake.FakeDriver2',
                                     first_arg=False)
     self.assertEqual(obj.__class__.__name__, 'FakeDriver2')
 def test_import_object_with_args(self):
     dt = importutils.import_object('datetime.datetime', 2012, 4, 5)
     self.assertIsInstance(dt, sys.modules['datetime'].datetime)
     self.assertEqual(dt, datetime.datetime(2012, 4, 5))
 def test_import_object_optional_arg_not_present(self):
     obj = importutils.import_object('oslo_utils.tests.fake.FakeDriver')
     self.assertEqual(obj.__class__.__name__, 'FakeDriver')
 def test_import_object(self):
     dt = importutils.import_object('datetime.time')
     self.assertIsInstance(dt, sys.modules['datetime'].time)
Esempio n. 5
0
 def test_import_object_required_arg_present(self):
     obj = importutils.import_object('oslo_utils.tests.fake.FakeDriver2',
                                     first_arg=False)
     self.assertEqual(obj.__class__.__name__, 'FakeDriver2')
Esempio n. 6
0
 def test_import_object_optional_arg_not_present(self):
     obj = importutils.import_object('oslo_utils.tests.fake.FakeDriver')
     self.assertEqual(obj.__class__.__name__, 'FakeDriver')
Esempio n. 7
0
 def test_import_object_with_args(self):
     dt = importutils.import_object('datetime.datetime', 2012, 4, 5)
     self.assertIsInstance(dt, sys.modules['datetime'].datetime)
     self.assertEqual(dt, datetime.datetime(2012, 4, 5))
Esempio n. 8
0
 def test_import_object(self):
     dt = importutils.import_object('datetime.time')
     self.assertIsInstance(dt, sys.modules['datetime'].time)