def test_dependency_target_attribute_is_working_properly(self): """testing if the dependency_target attribute is working properly """ tdep = TaskDependency(**self.kwargs) onstart = 'onstart' tdep.dependency_target = onstart self.assertEqual(onstart, tdep.dependency_target)
def test_dependency_target_attribute_is_None(self): """testing if the default value will be used when the dependency_target attribute is set to None """ tdep = TaskDependency(**self.kwargs) tdep.dependency_target = None self.assertEqual(tdep.dependency_target, defaults.task_dependency_targets[0])
def test_dependency_target_attribute_is_working_properly(self): """testing if the dependency_target attribute is working properly """ from stalker import TaskDependency tdep = TaskDependency(**self.kwargs) onstart = 'onstart' tdep.dependency_target = onstart assert tdep.dependency_target == onstart
def test_dependency_target_attribute_is_None(self): """testing if the default value will be used when the dependency_target attribute is set to None """ from stalker import defaults, TaskDependency tdep = TaskDependency(**self.kwargs) tdep.dependency_target = None assert tdep.dependency_target == defaults.task_dependency_targets[0]
def test_dependency_target_attribute_value_is_not_in_the_enum_list(self): """testing if a ValueError will be raised when the dependency_target attribute value is not one of ['duration', 'length'] """ from stalker import TaskDependency tdep = TaskDependency(**self.kwargs) with pytest.raises(ValueError) as cm: tdep.dependency_target = 'not in the list' assert str(cm.value) == \ "TaskDependency.dependency_target should be one of ['onend', " \ "'onstart'], not 'not in the list'"
def test_dependency_target_attribute_is_not_a_string_instance(self): """testing if a TypeError will be raised when the dependency_target attribute is not a string """ from stalker import TaskDependency tdep = TaskDependency(**self.kwargs) with pytest.raises(TypeError) as cm: tdep.dependency_target = 0 assert str(cm.value) == \ "TaskDependency.dependency_target should be a string with a " \ "value one of ['onend', 'onstart'], not int"
def test_dependency_target_attribute_is_not_a_string_instance(self): """testing if a TypeError will be raised when the dependency_target attribute is not a string """ from stalker import TaskDependency tdep = TaskDependency(**self.kwargs) with self.assertRaises(TypeError) as cm: tdep.dependency_target = 0 self.assertEqual( str(cm.exception), "TaskDependency.dependency_target should be a string with a value " "one of ['onend', 'onstart'], not int")