MCPcopy Index your code
hub / github.com/CadQuery/cadquery / testFluentMethodInheritance

Method testFluentMethodInheritance

tests/test_cadquery.py:243–262  ·  view source on GitHub ↗

Tests that a derived class inherits fluent methods which return instances of derived class when inherited.

(self)

Source from the content-addressed store, hash-verified

241 self.saveModel(s)
242
243 def testFluentMethodInheritance(self):
244 """
245 Tests that a derived class inherits fluent methods which return
246 instances of derived class when inherited.
247 """
248
249 class ExtendedWorkplane(Workplane):
250 def nonExistentInWorkplane(self):
251 pass
252
253 # Call an inherited fluent method:
254 wp = ExtendedWorkplane("XY").moveTo(1, 2)
255
256 # Verify that the inherited method returned an instance of the derived
257 # class:
258 self.assertEqual(type(wp), ExtendedWorkplane)
259
260 # The following is redundant, but can make the use case clearer.
261 # This must not raise an AttributeError:
262 wp.nonExistentInWorkplane()
263
264 def testPointList(self):
265 """

Callers

nothing calls this directly

Calls 3

ExtendedWorkplaneClass · 0.85
moveToMethod · 0.80

Tested by

no test coverage detected