1
"""Classes used in pickling tests, need to be at the module level for
8
class User(fixtures.ComparableEntity):
12
class Order(fixtures.ComparableEntity):
16
class Dingaling(fixtures.ComparableEntity):
20
class EmailUser(User):
24
class Address(fixtures.ComparableEntity):
28
# TODO: these are kind of arbitrary....
29
class Child1(fixtures.ComparableEntity):
33
class Child2(fixtures.ComparableEntity):
37
class Parent(fixtures.ComparableEntity):
43
def __init__(self, obj, parent=None):
50
def __init__(self, moredata):
52
self.stuff = 'im stuff'
53
self.moredata = moredata
55
__hash__ = object.__hash__
57
def __eq__(self, other):
58
return other.data == self.data and \
59
other.stuff == self.stuff and \
60
other.moredata == self.moredata
65
def __init__(self, x, y):
69
__hash__ = object.__hash__
71
def __eq__(self, other):
72
return other.__class__ is self.__class__ and \
73
other.x == self.x and \
77
return "Bar(%d, %d)" % (self.x, self.y)
82
def __init__(self, x, y):
86
def __eq__(self, other):
87
return other.__class__ is self.__class__ and \
88
other.x == self.x and \
92
class OldSchoolWithoutCompare:
94
def __init__(self, x, y):
99
class BarWithoutCompare(object):
101
def __init__(self, x, y):
106
return "Bar(%d, %d)" % (self.x, self.y)
109
class NotComparable(object):
111
def __init__(self, data):
117
def __eq__(self, other):
118
return NotImplemented
120
def __ne__(self, other):
121
return NotImplemented
124
class BrokenComparable(object):
126
def __init__(self, data):
132
def __eq__(self, other):
133
raise NotImplementedError
135
def __ne__(self, other):
136
raise NotImplementedError