Skip to content

Commit 1b0c387

Browse files
committed
added test_pop_axis_and_swap() to test_geometry.py
1 parent 2f24e48 commit 1b0c387

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_components/test_geometry.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,20 @@ def test_pop_axis():
778778
assert Ly == _Ly
779779

780780

781+
def test_pop_axis_and_swap():
782+
b = td.Box(size=(1, 1, 1))
783+
for swap_axes in (False, True):
784+
for axis in range(3):
785+
coords = (1, 2, 3)
786+
Lz, (Lx, Ly) = b.pop_axis_and_swap(coords, axis=axis, swap_axes=swap_axes)
787+
_coords = b.unpop_axis_and_swap(Lz, (Lx, Ly), axis=axis, swap_axes=swap_axes)
788+
assert all(c == _c for (c, _c) in zip(coords, _coords))
789+
_Lz, (_Lx, _Ly) = b.pop_axis_and_swap(_coords, axis=axis, swap_axes=swap_axes)
790+
assert Lz == _Lz
791+
assert Lx == _Lx
792+
assert Ly == _Ly
793+
794+
781795
def test_2b_box_intersections():
782796
plane = td.Box(size=(1, 4, 0))
783797
box1 = td.Box(size=(1, 1, 1))

0 commit comments

Comments
 (0)