def test_empty_variable_kwargs_functionality(self): simple_object_1 = SimpleSerializable( 'ARG1', *('ARGS[1]', 'ARGS[2]'), kwarg1='KWARG1') simple_object_2 = Serializable.clone(simple_object_1) assert_objects_match(simple_object_1, simple_object_2)
def copy(self): """Create a deep copy the environment. TODO: Investigate if this can be done somehow else, especially for gym envs. """ return Serializable.clone(self)
def test_variable_kwargs_functionality(self): simple_object_1 = SimpleSerializable( 'ARG1', **{'kwargs[1]': 'KWARGS[1]', 'kwargs[2]': 'KWARGS[2]'}) simple_object_2 = Serializable.clone(simple_object_1) assert_objects_match(simple_object_1, simple_object_2)
def test_default_initialization(self): class UninitializedSerializable(Serializable): def __init__(self, arg1, *args, kwarg1=None, **kwargs): self.arg1 = arg1 self.args = args self.kwarg1 = kwarg1 self.kwargs = kwargs simple_object_1 = UninitializedSerializable( 'ARG1', *('ARGS[1]', 'ARGS[2]'), kwarg1='KWARG1', **{'kwargs[1]': 'KWARGS[1]', 'kwargs[2]': 'KWARGS[2]'}) with self.assertRaises(AssertionError): Serializable.clone(simple_object_1)
def test_missing_default_values(self): simple_object_1 = SimpleSerializable( 'ARG1', *('ARGS[1]', 'ARGS[2]'), **{'kwargs[1]': 'KWARGS[1]', 'kwargs[2]': 'KWARGS[2]'}) simple_object_2 = Serializable.clone(simple_object_1) assert_objects_match(simple_object_1, simple_object_2)
def test_mixed_argument_types(self): simple_object_1 = SimpleSerializable( 'ARG1', *('ARGS[1]', 'ARGS[2]'), kwarg1='KWARG1', **{'kwargs[1]': 'KWARGS[1]', 'kwargs[2]': 'KWARGS[2]'}) simple_object_2 = Serializable.clone(simple_object_1) assert_objects_match(simple_object_1, simple_object_2)
def test_kwargs_functionality(self): simple_object_1 = SimpleSerializable('ARG1', kwarg1='KWARG1') simple_object_2 = Serializable.clone(simple_object_1) assert_objects_match(simple_object_1, simple_object_2)