def test_works_with_quantity_arrays(self): a = sp.array([[1]]) * pq.s b = sp.array([[2000]]) * pq.ms c = sp.array([[3]]) * pq.s axis = 1 expected = sp.array([[1, 2, 3]]) * pq.s actual = spq.concatenate((a, b, c), axis=axis) assert_array_equal(expected, actual)
def test_works_with_normal_and_quantity_arrays_mixed(self): a = sp.array([[1]]) b = sp.array([[2]]) * pq.dimensionless c = sp.array([[3]]) axis = 1 expected = sp.array([[1, 2, 3]]) actual = spq.concatenate((a, b, c), axis=axis) assert_array_equal(expected, actual)
def test_works_with_normal_arrays(self): a = sp.array([[1]]) b = sp.array([[2]]) c = sp.array([[3]]) axis = 1 expected = sp.array([[1, 2, 3]]) actual = spq.concatenate((a, b, c), axis=axis) assert_array_equal(expected, actual)
def test_raises_exception_if_mixing_incompatible_units(self): a = sp.array([[1]]) b = sp.array([[2]]) * pq.dimensionless c = sp.array([[3]]) * pq.s d = sp.array([[4]]) * pq.m for p in combinations((a, c, d), 2): with self.assertRaises(Exception): spq.concatenate(p) with self.assertRaises(Exception): spq.concatenate(p[::-1]) for p in combinations((b, c, d), 2): with self.assertRaises(Exception): spq.concatenate(p) with self.assertRaises(Exception): spq.concatenate(p[::-1])