def test_set_location(self): f = Feature(ctype='d') expected = [random.random(), random.random()] f.location = expected # making sure that we went through the setter, and not just setting the # exact value to the property numpy.testing.assert_almost_equal(f.location, expected, 16) f = Feature(ctype='f') expected = [random.random(), random.random()] f.location = expected numpy.testing.assert_almost_equal(f.location, expected, 6)
def test_set_location(self): f = Feature(ctype=ctypes.c_double) expected = [[random.random()], [random.random()]] f.location = expected # making sure that we went through the setter, and not just setting the # exact value to the property nose.tools.assert_is_instance(f.location, EigenArray) numpy.testing.assert_almost_equal(f.location, expected, 16) f = Feature(ctype=ctypes.c_float) expected = [[random.random()], [random.random()]] f.location = expected nose.tools.assert_is_instance(f.location, EigenArray) numpy.testing.assert_almost_equal(f.location, expected, 6)