コード例 #1
0
def test_dependency_instance():
    class LocalConfig(Configuration):
        FirstDependency = Instance(class_path(FakeClass))

    apply_configs(LocalConfig)
    sample = SampleClass()
    dep1 = get_dependency('FirstDependency')
    assert id(dep1) == id(sample.dep1)
    clear_config()
コード例 #2
0
def test_dependency_import():
    class LocalConfig(Configuration):
        FirstDependency = Import(class_path(FakeClass))

    apply_configs(LocalConfig)
    sample = SampleClass()
    dep1 = get_dependency('FirstDependency')
    assert dep1 == FakeClass
    assert sample.dep1 == FakeClass