Skip to content

Commit ecc63d4

Browse files
authored
Merge pull request #25 from boutproject/version-parse
Do not use custom version parsing
2 parents cbbc3aa + 844ab44 commit ecc63d4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

tests/test_blocks.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ def test_list_input(self):
141141
npt.assert_equal(line_block.x, np.array([[1, 2, 3], [1, 2, 3]]))
142142

143143
def test_ragged_list_input(self):
144-
npv = tuple([int(x) for x in np.__version__.split(".")[:3]])
145-
if npv >= (1, 24):
144+
if packaging.version.parse(np.__version__) >= packaging.version.parse("1.24"):
146145
pytest.skip("numpy to new - will raise error")
147146
x_data = [np.array([1, 2, 3]), np.array([1, 2, 3, 4])]
148147
y_data = [np.array([5, 6, 7]), np.array([4, 2, 9, 10])]
@@ -157,8 +156,7 @@ def test_ragged_list_input(self):
157156
assert_jagged_arrays_equal(line_block.y, np.array(y_data))
158157

159158
def test_bad_ragged_list_input(self):
160-
npv = tuple([int(x) for x in np.__version__.split(".")[:3]])
161-
if npv >= (1, 24):
159+
if packaging.version.parse(np.__version__) >= packaging.version.parse("1.24"):
162160
pytest.skip("numpy to new - will raise error")
163161
x_data = np.array([np.array([1, 2, 3]), np.array([1, 2, 3, 4])])
164162
y_data = np.array([np.array([5, 6, 7]), np.array([4, 2, 9, 10, 11])])
@@ -319,8 +317,7 @@ def test_Quiver(self):
319317

320318
@animation_compare(baseline_images="Blocks/Surface", nframes=3)
321319
def test_Surface(self):
322-
mpl_version = tuple([int(x) for x in mpl._version.version.split(".")[:3]])
323-
if mpl_version < (3, 9):
320+
if packaging.version.parse(mpl.__version__) < packaging.version.parse("3.9.0"):
324321
pytest.xfail("Updated for MPL 3.9.0")
325322
x = np.linspace(-2 * np.pi, 2 * np.pi, 100)
326323
t = np.linspace(0, 2 * np.pi, 3)

0 commit comments

Comments
 (0)