Beispiel #1
0
    def test_resolve_to_callable_registry(self):
        from ramses import registry

        @registry.add
        def foo():
            pass

        func = utils.resolve_to_callable('{{foo}}')
        assert func is foo
        func = utils.resolve_to_callable('foo')
        assert func is foo
Beispiel #2
0
 def test_resolve_to_callable_dotted_path(self):
     from datetime import datetime
     func = utils.resolve_to_callable('{{datetime.datetime}}')
     assert func is datetime
     func = utils.resolve_to_callable('datetime.datetime')
     assert func is datetime
Beispiel #3
0
 def test_resolve_to_callable_not_found(self):
     with pytest.raises(ImportError) as ex:
         utils.resolve_to_callable('{{foobar}}')
     assert str(ex.value) == 'Failed to load callable `foobar`'