def test_passing_interfaces_only(self): xi1 = [1, 2, 3] * u.m xi2 = [1, 2, 3] * u.m g = grid.PolarGrid(r_i=xi1, phi_i=xi2) self.assertTrue(all(g.phi_d == [1, 1] * u.m)) self.assertTrue(all(g.phi_c == [1.5, 2.5] * u.m)) self.assertEqual(g.dim, 2)
def test_active_interfaces_wrong_definition(self): xi1 = [1, 2, 3] * u.m xi2 = [1, 2, 3] * u.m with self.assertRaises(ValueError): g = grid.PolarGrid(r_i=xi1, phi_i=xi2, active_interfaces=["foodim"])
def test_active_interfaces(self): xi1 = [1, 2, 3] * u.m xi2 = [1, 2, 3] * u.m g = grid.PolarGrid(r_i=xi1, phi_i=xi2, active_interfaces=["phi"]) self.assertTrue(all(g.get_coordinates("r") == [1.5, 2.5] * u.m)) self.assertTrue(all(g.get_coordinates("phi") == xi2)) self.assertEqual(g.dim, 2)
def test_passing_xc_dx(self): xc3 = [1, 3.5, 7.5] * u.m dx3 = [2, 3, 5] * u.m g = grid.PolarGrid(r_c=xc3, r_d=dx3) self.assertTrue(all(g.r_i == [0, 2, 5, 10] * u.m))