Exemplo n.º 1
0
 def test_passing_interfaces_only(self):
     xi1 = [1, 2, 3] * u.m
     xi2 = [1, 2, 3] * u.m
     g = grid.RegularGrid(x1_i=xi1, x2_i=xi2)
     self.assertTrue(all(g.x1_d == [1, 1] * u.m))
     self.assertTrue(all(g.x1_c == [1.5, 2.5] * u.m))
     self.assertEqual(g.dim, 2)
Exemplo n.º 2
0
 def test_fail_on_only_centers(self):
     with self.assertRaises(ValueError):
         grid.RegularGrid(x1_c=[1, 2, 3] * u.m)
Exemplo n.º 3
0
 def test_no_unit(self):
     with self.assertRaises(TypeError):
         grid.RegularGrid(x1_i=np.array([1, 2, 3]))
Exemplo n.º 4
0
 def test_fail_on_interfaces_or_centers(self):
     with self.assertRaises(ValueError):
         grid.RegularGrid(x1_d=[1, 2, 3] * u.m)
Exemplo n.º 5
0
 def test_passing_xc_dx(self):
     xc3 = [1, 3.5, 7.5] * u.m
     dx3 = [2, 3, 5] * u.m
     g = grid.RegularGrid(x3_c=xc3, x3_d=dx3)
     self.assertTrue(all(g.x3_i == [0, 2, 5, 10] * u.m))