Exemplo n.º 1
0
    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'
Exemplo n.º 2
0
def rdims3(tdim3):
    """Create an example of integer `Dimension`."""
    rdim3 = ReshapedDimension(transformer=Identity(tdim3.type),
                              original_dimension=tdim3,
                              index=2)

    return {tdim3.name: rdim3}
Exemplo n.º 3
0
 def test_repr_format(self):
     """Check representation of a transformed dimension."""
     t = Identity()
     assert t.repr_format('asfa') == 'asfa'
Exemplo n.º 4
0
 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,)
Exemplo n.º 5
0
 def test_reverse(self):
     """Check if it reverses `transform` properly, if possible."""
     t = Identity()
     assert t.reverse('yo') == 'yo'
Exemplo n.º 6
0
 def test_transform(self):
     """Check if it transforms properly."""
     t = Identity()
     assert t.transform('yo') == 'yo'
Exemplo n.º 7
0
 def test_deepcopy(self):
     """Verify that the transformation object can be copied"""
     t = Identity()
     t.transform([2])
     copy.deepcopy(t)