コード例 #1
0
 def test_bad_module(self):
     with pytest.raises(ImportError):
         import_object('an.invalid.module')
コード例 #2
0
 def test_bad_object_name(self):
     with pytest.raises(AttributeError):
         import_object(__name__ + '.InvalidName')
コード例 #3
0
    def test_function(self):
        imported = import_object(__name__ + '.dummy_function')

        assert imported is dummy_function
コード例 #4
0
    def test_class_method(self):
        imported = import_object(__name__ + '.DummyClass.a_method')

        assert imported is DummyClass.a_method
コード例 #5
0
    def test_class(self):
        imported = import_object(__name__ + '.DummyClass')

        assert imported is DummyClass
コード例 #6
0
ファイル: test_mlblock.py プロジェクト: mikewlange/MLBlocks
def test_import_object():
    dummy_class = import_object(__name__ + '.DummyClass')

    assert dummy_class is DummyClass