def test_domain_and_target_type(self): """Check if attribute-like `domain_type` and `target_type` do what's expected. """ t = Identity() assert t.domain_type is None assert t.target_type is None t = Identity('mpogias') assert t.domain_type == 'mpogias' assert t.target_type == 'mpogias'
def rdims3(tdim3): """Create an example of integer `Dimension`.""" rdim3 = ReshapedDimension(transformer=Identity(tdim3.type), original_dimension=tdim3, index=2) return {tdim3.name: rdim3}
def test_repr_format(self): """Check representation of a transformed dimension.""" t = Identity() assert t.repr_format('asfa') == 'asfa'
def test_infer_target_shape(self): """Check if it infers the shape of a transformed `Dimension`.""" t = Identity() assert t.infer_target_shape((5,)) == (5,)
def test_reverse(self): """Check if it reverses `transform` properly, if possible.""" t = Identity() assert t.reverse('yo') == 'yo'
def test_transform(self): """Check if it transforms properly.""" t = Identity() assert t.transform('yo') == 'yo'
def test_deepcopy(self): """Verify that the transformation object can be copied""" t = Identity() t.transform([2]) copy.deepcopy(t)