Пример #1
0
 def test_zero_resolution(self):
     kwargs = dict(resolution=[3, 0], ndim=2, dtype=float)
     expected_exception = ValueError
     match = "All elements of resolution must be positive."
     with pytest.raises(expected_exception, match=match):
         _validate_resolution(**kwargs)
Пример #2
0
 def test_array_resolution_3D_ndim(self):
     kwargs = dict(resolution=np.ones(3, int), ndim=3, dtype=float)
     correct_output = np.ones(3, float)
     assert np.array_equal(_validate_resolution(**kwargs), correct_output)
Пример #3
0
 def test_list_resolution_2D_ndim(self):
     kwargs = dict(resolution=[3, 4], ndim=2, dtype=float)
     correct_output = np.array([3, 4], float)
     assert np.array_equal(_validate_resolution(**kwargs), correct_output)
Пример #4
0
 def test_scalar_resolution_4D_ndim(self):
     kwargs = dict(resolution=1.5, ndim=4, dtype=float)
     correct_output = np.full(4, 1.5, float)
     assert np.array_equal(_validate_resolution(**kwargs), correct_output)