diff --git a/nose_ignores.txt b/nose_ignores.txt index a60796b5707..115b917d59d 100644 --- a/nose_ignores.txt +++ b/nose_ignores.txt @@ -44,3 +44,4 @@ --ignore-file=test_minimal_representation\.py --ignore-file=test_set_log_level\.py --ignore-file=test_field_parsing\.py +--ignore-file=test_disks\.py diff --git a/pyproject.toml b/pyproject.toml index 37df5e4b76a..50d2bd55f55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -341,7 +341,6 @@ addopts = ''' --ignore-glob='/*/yt/data_objects/tests/test_connected_sets.py' --ignore-glob='/*/yt/data_objects/tests/test_data_containers.py' --ignore-glob='/*/yt/data_objects/tests/test_dataset_access.py' - --ignore-glob='/*/yt/data_objects/tests/test_disks.py' --ignore-glob='/*/yt/data_objects/tests/test_particle_filter.py' --ignore-glob='/*/yt/data_objects/tests/test_particle_trajectories.py' --ignore-glob='/*/yt/data_objects/tests/test_pickling.py' diff --git a/yt/data_objects/tests/test_disks.py b/yt/data_objects/tests/test_disks.py index 1e2abebe50d..8d87ed1d07a 100644 --- a/yt/data_objects/tests/test_disks.py +++ b/yt/data_objects/tests/test_disks.py @@ -1,5 +1,4 @@ -from nose.tools import assert_raises -from numpy.testing import assert_equal +import pytest from yt import YTQuantity from yt.testing import fake_random_ds @@ -10,31 +9,37 @@ def test_bad_disk_input(): ds = fake_random_ds(16) # Test invalid 3d array - with assert_raises(TypeError) as ex: + with pytest.raises( + TypeError, + match=r"^Expected an array of size \(3,\), received 'list' of length 4$", + ): ds.disk(ds.domain_center, [0, 0, 1, 1], (10, "kpc"), (20, "kpc")) - desired = "Expected an array of size (3,), received 'list' of length 4" - assert_equal(str(ex.exception), desired) # Test invalid float - with assert_raises(TypeError) as ex: + with pytest.raises( + TypeError, + match=( + r"^Expected a numeric value \(or size-1 array\), " + r"received 'unyt.array.unyt_array' of length 3$" + ), + ): ds.disk(ds.domain_center, [0, 0, 1], ds.domain_center, (20, "kpc")) - desired = ( - "Expected a numeric value (or size-1 array)," - " received 'unyt.array.unyt_array' of length 3" - ) - assert_equal(str(ex.exception), desired) # Test invalid float - with assert_raises(TypeError) as ex: + with pytest.raises( + TypeError, + match=( + r"^Expected a numeric value \(or tuple of format \(float, String\)\), " + r"received an inconsistent tuple '\(10, 10\)'.$" + ), + ): ds.disk(ds.domain_center, [0, 0, 1], (10, 10), (20, "kpc")) - desired = ( - "Expected a numeric value (or tuple of format (float, String))," - " received an inconsistent tuple '(10, 10)'." - ) - assert_equal(str(ex.exception), desired) # Test invalid iterable - with assert_raises(TypeError) as ex: + with pytest.raises( + TypeError, + match=r"^Expected an iterable object, received 'unyt\.array\.unyt_quantity'$", + ): ds.disk( ds.domain_center, [0, 0, 1], @@ -42,18 +47,16 @@ def test_bad_disk_input(): (20, "kpc"), fields=YTQuantity(1, "kpc"), ) - desired = "Expected an iterable object, received 'unyt.array.unyt_quantity'" - assert_equal(str(ex.exception), desired) # Test invalid object - with assert_raises(TypeError) as ex: + with pytest.raises( + TypeError, + match=( + r"^Expected an object of 'yt\.data_objects\.static_output\.Dataset' type, " + r"received 'yt\.data_objects\.selection_objects\.region\.YTRegion'$" + ), + ): ds.disk(ds.domain_center, [0, 0, 1], (10, "kpc"), (20, "kpc"), ds=ds.all_data()) - desired = ( - "Expected an object of 'yt.data_objects.static_output.Dataset' " - "type, received " - "'yt.data_objects.selection_objects.region.YTRegion'" - ) - assert_equal(str(ex.exception), desired) # Test valid disk ds.disk(ds.domain_center, [0, 0, 1], (10, "kpc"), (20, "kpc"))