Appendix: Functions in Module testEqual¶
These are the functions in module testEqual, which is used to help verify examples
in this document.
-
isEmptyShape(a)¶ Test if shape
ais empty. ReturnTrueif shape is empty,Falseotherwise.Trueis returned ifaisNone(not a shape) butFalsefor other non-shapes.
-
areEqual(a, b)¶ Test if shapes
aandbare equal. ReturnTrueorFalse. The main part of this test is based on the observation thata.cut(b)andb.cut(a)()should both be empty if the objects are equal. The first checks are just for the case whereaorbis empty, causing cut to fail.
-
testEqual(a, b)¶ Check if shapes
aandbare equal and raise an exception if they are not.
-
testNotEqual(a, b)¶ Check if shapes
aandbare equal and raise an exception if they are.
-
isSubset(a, b)¶ Test if shape
ais a subset ofb. ReturnTrueorFalse. Equality is considered to be a subset (Trueis returned). A strict subset (non-equal) is based on the observation thata.cut(b)is not empty butb.cut(a)is empty. The first checks are just for case whereaorbis empty, causing cut to fail.
-
testSubset(a, b)¶ Check if shape
ais a (non-strict) subset ofband raise an exception if it is not.
-
testNotSubset(a, b)¶ Check if shape
ais not a (non-strict) subset ofband raise an exception if it is.