Skip to content

Commit

Permalink
Clean up InplaceModificationTest
Browse files Browse the repository at this point in the history
  • Loading branch information
deltaLuki committed Jun 26, 2023
1 parent f18d2d0 commit 5c19579
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
9 changes: 9 additions & 0 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,15 @@ def get_all_spline_typs_as_list():
]


def get_all_spline_types_empty_as_list():
return [
splinepy.BSpline(),
splinepy.NURBS(),
splinepy.Bezier(),
splinepy.RationalBezier(),
]


def get_all_splines_as_dict_as_list():
return [b2p2d(), n2p2d(), z2p2d(), r2p2d()]

Expand Down
27 changes: 9 additions & 18 deletions tests/test_property_modification.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,20 @@ class InplaceModificationTest(c.unittest.TestCase):
def test_inplace_change_degrees(self):
"""inplace change of degrees should not be allowed if core spline is
initialized"""
z = c.z2p2d()
r = c.r2p2d()
b = c.b2p2d()
n = c.n2p2d()

Z, R, B, N = (
c.splinepy.Bezier,
c.splinepy.RationalBezier,
c.splinepy.BSpline,
c.splinepy.NURBS,
)

for props, SClass in zip((z, r, b, n), (Z, R, B, N)):

for props, spline in zip(
c.get_all_splines_as_dict_as_list(),
c.get_all_spline_types_empty_as_list(),
):
# test no core spline
# this should be fine
s = SClass()
s.degrees = props["degrees"]
s.degrees += 1
spline.degrees = props["degrees"]
spline.degrees += 1

# this shoundn't be fine
s.new_core(**props)
spline.new_core(**props)
with self.assertRaises(ValueError):
s.degrees += 1
spline.degrees += 1

def test_inplace_change_knot_vectors(self):
"""test inplace change of knot_vectors"""
Expand Down

0 comments on commit 5c19579

Please sign in to comment.