def test_build_from_config2(self): """Test building a interfaceable interface with an interface from a config. """ self.mixin.interface = IIinterfaceTest1(answer=True) self.root.update_preferences_from_members() deps = { 'ecpy.task': { 'tests.Mixin': Mixin, 'ecpy.RootTask': RootTask }, 'ecpy.tasks.interface': { 'tests.Mixin:tests.InterfaceTest3': InterfaceTest3, 'tests.Mixin:tests.InterfaceTest3:tests.IIinterfaceTest1': IIinterfaceTest1 } } bis = RootTask.build_from_config(self.root.preferences, deps) interface = bis.children[0].interface.interface assert type(interface).__name__ == 'IIinterfaceTest1' assert self.root.children[0].database_entries ==\ {'test': 2.0, 'itest': 1.0}
def test_build_root_from_config(): """Test building a RootTask from config. """ class DummyTask(SimpleTask): database_entries = {'test': 1} config = { 'name': 'test', 'children_0': { 'name': 'test_child', 'task_id': 'DummyTask' } } task = RootTask.build_from_config(config, {'ecpy.task': { 'DummyTask': DummyTask }}) assert task.name == 'Root' assert len(task.children) == 1 assert task.children[0].name == 'test_child' assert task.children[0].root assert isinstance(task.children[0], DummyTask) assert task.get_from_database('test_child_test')
def test_build_from_config2(self): """Test building a interfaceable task with an interface from a config. """ self.mixin.interface = InterfaceTest(answer=True) self.root.update_preferences_from_members() deps = {'ecpy.task': {'tests.Mixin': Mixin, 'ecpy.RootTask': RootTask}, 'ecpy.tasks.interface': {('InterfaceTest', ('tests.Mixin',)): InterfaceTest}} bis = RootTask.build_from_config(self.root.preferences, deps) assert type(bis.children[0].interface).__name__ == 'InterfaceTest'
def test_build_from_config1(self): """Test building a interfaceable task with no interface from a config. """ aux = RootTask() aux.add_child_task(0, IMixin()) bis = RootTask.build_from_config(aux.preferences, {'ecpy.task': {'tests.IMixin': IMixin, 'ecpy.RootTask': RootTask}}) assert type(bis.children[0]).__name__ == 'IMixin'
def test_build_from_config1(self): """Test building a interfaceable task with no interface from a config. """ aux = RootTask() aux.add_child_task(0, IMixin()) bis = RootTask.build_from_config( aux.preferences, {'ecpy.task': { 'tests.IMixin': IMixin, 'ecpy.RootTask': RootTask }}) assert type(bis.children[0]).__name__ == 'IMixin'
def test_build_from_config1(self): """Test building a interfaceable interface with no interface from a config. """ aux = RootTask() mixin = Mixin() mixin.interface = InterfaceTest3() aux.add_child_task(0, mixin) deps = {'ecpy.task': {'tests.Mixin': Mixin, 'ecpy.RootTask': RootTask}, 'ecpy.tasks.interface': {('InterfaceTest3', ('tests.Mixin',)): InterfaceTest3}} bis = RootTask.build_from_config(aux.preferences, deps) assert type(bis.children[0].interface).__name__ == 'InterfaceTest3'
def test_build_from_config2(self): """Test building a interfaceable task with an interface from a config. """ self.mixin.interface = InterfaceTest(answer=True) self.root.update_preferences_from_members() deps = { 'ecpy.task': { 'tests.Mixin': Mixin, 'ecpy.RootTask': RootTask }, 'ecpy.tasks.interface': { 'tests.Mixin:tests.InterfaceTest': InterfaceTest } } bis = RootTask.build_from_config(self.root.preferences, deps) assert type(bis.children[0].interface).__name__ == 'InterfaceTest'
def test_build_from_config1(self): """Test building a interfaceable interface with no interface from a config. """ aux = RootTask() mixin = Mixin() mixin.interface = InterfaceTest3() aux.add_child_task(0, mixin) deps = { 'ecpy.task': { 'tests.Mixin': Mixin, 'ecpy.RootTask': RootTask }, 'ecpy.tasks.interface': { 'tests.Mixin:tests.InterfaceTest3': InterfaceTest3 } } bis = RootTask.build_from_config(aux.preferences, deps) assert type(bis.children[0].interface).__name__ == 'InterfaceTest3'
def test_build_root_from_config(): """Test building a RootTask from config. """ class DummyTask(SimpleTask): database_entries = {'test': 1} config = {'name': 'test', 'children_0': {'name': 'test_child', 'task_id': 'DummyTask'}} task = RootTask.build_from_config(config, {'ecpy.task': {'DummyTask': DummyTask}}) assert task.name == 'Root' assert len(task.children) == 1 assert task.children[0].name == 'test_child' assert task.children[0].root assert isinstance(task.children[0], DummyTask) assert task.get_from_database('test_child_test')
def test_build_from_config2(self): """Test building a interfaceable interface with an interface from a config. """ self.mixin.interface = IIinterfaceTest1(answer=True) self.root.update_preferences_from_members() deps = {'ecpy.task': {'tests.Mixin': Mixin, 'ecpy.RootTask': RootTask}, 'ecpy.tasks.interface': {('InterfaceTest3', ('tests.Mixin',)): InterfaceTest3, ('IIinterfaceTest1', ('tests.Mixin', 'InterfaceTest3')): IIinterfaceTest1 } } bis = RootTask.build_from_config(self.root.preferences, deps) interface = bis.children[0].interface.interface assert type(interface).__name__ == 'IIinterfaceTest1' assert self.root.children[0].database_entries ==\ {'test': 2.0, 'itest': 1.0}