def test_check_context(self): check('N', 1, N=1) fail('N', 1, N=2) self.assertRaises(ContractNotRespected, check, 'N', 1, N=2) self.assertRaises(ValueError, fail, 'N', 1, N=1)
def test_check_context(): check('N', 1, N=1) fail('N', 1, N=2) with raises(ContractNotRespected): check('N', 1, N=2) with raises(ValueError): fail('N', 1, N=1)
def test_checks(self): R = np.zeros((10, 10)) fail('rotation_matrix', R) R = random_rotation() R[0, 2] += R[0, 1] fail('rotation_matrix', R) R = random_rotation() R *= 2 fail('rotation_matrix', R)
def test_checks(self): R = np.zeros((10, 10)) fail("rotation_matrix", R) R = random_rotation() R[0, 2] += R[0, 1] fail("rotation_matrix", R) R = random_rotation() R *= 2 fail("rotation_matrix", R)
def test_checks(self): if not self.is_contracts_active(): return R = np.zeros((10, 10)) fail('rotation_matrix', R) R = random_rotation() R[0, 2] += R[0, 1] fail('rotation_matrix', R) R = random_rotation() R *= 2 fail('rotation_matrix', R)
def test_unit_length(self): check('unit_length', np.array([1])) check('unit_length', np.array([0, 1])) fail('unit_length', np.array([0, 2]))
def test_check_fail(): z = 2 check('$z', 2) fail('$z', 3)
def test_unit_length(self): check("unit_length", np.array([1])) check("unit_length", np.array([0, 1])) fail("unit_length", np.array([0, 2]))
def test_unit_length(self): if not self.is_contracts_active(): return check('unit_length', np.array([1])) check('unit_length', np.array([0, 1])) fail('unit_length', np.array([0, 2]))