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
a
is empty. ReturnTrue
if shape is empty,False
otherwise.True
is returned ifa
isNone
(not a shape) butFalse
for other non-shapes.
-
areEqual
(a, b)¶ Test if shapes
a
andb
are equal. ReturnTrue
orFalse
. 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 wherea
orb
is empty, causing cut to fail.
-
testEqual
(a, b)¶ Check if shapes
a
andb
are equal and raise an exception if they are not.
-
testNotEqual
(a, b)¶ Check if shapes
a
andb
are equal and raise an exception if they are.
-
isSubset
(a, b)¶ Test if shape
a
is a subset ofb
. ReturnTrue
orFalse
. Equality is considered to be a subset (True
is 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 wherea
orb
is empty, causing cut to fail.
-
testSubset
(a, b)¶ Check if shape
a
is a (non-strict) subset ofb
and raise an exception if it is not.
-
testNotSubset
(a, b)¶ Check if shape
a
is not a (non-strict) subset ofb
and raise an exception if it is.