Add a GetIM() method to Colour, Point, Size, Rect and other ‘value’ types.

GetIM() returns a replicant of the original object that is immutable, so it can be used as a dictionary key, or etc., but still gives access to the properties by name, which using the Get() method to get a tuple of the values does not do.
This commit is contained in:
Robin Dunn
2017-04-14 19:19:26 -07:00
parent a79cd3254c
commit 52facb4d7f
15 changed files with 194 additions and 0 deletions

View File

@@ -48,6 +48,19 @@ class position_Tests(wtc.WidgetTestCase):
self.assertTrue(p4 == p1)
def test_GetIM(self):
# Test the immutable version returned by GetIM
obj = wx.Position(1,2)
im = obj.GetIM()
assert isinstance(im, tuple)
assert im.Row == obj.Row
assert im.Col == obj.Col
obj2 = wx.Position(im)
assert obj == obj2
#---------------------------------------------------------------------------