예제 #1
0
    def test_factory_create(self):
        module_name = 'MockModuleName'
        ModuleFactory.register(module_name, MockModule)
        MockModule.__abstractmethods__ = set()

        module_obj = ModuleFactory.create('Some name', module_name)
        assert type(module_obj) == MockModule
예제 #2
0
    def test_factory_create_module_type_not_registered(self):
        module_name = 'NotRegisteredModuleName'

        with pytest.raises(KeyError):
            ModuleFactory.create('Some name', module_name)