Added __ne__ operator support for Country object, fixes #45
This commit is contained in:
@@ -272,6 +272,8 @@ API Documentation
|
||||
|
||||
.. autofunction:: sort_query
|
||||
.. autofunction:: escape_like
|
||||
.. autofunction:: naturally_equivalent
|
||||
.. autofunction:: has_changes
|
||||
.. autofunction:: non_indexed_foreign_keys
|
||||
.. autofunction:: is_indexed_foreign_key
|
||||
.. autofunction:: identity
|
||||
|
@@ -23,6 +23,9 @@ class Country(object):
|
||||
else:
|
||||
return NotImplemented
|
||||
|
||||
def __ne__(self, other):
|
||||
return not (self == other)
|
||||
|
||||
def __repr__(self):
|
||||
return '%s(%r)' % (self.__class__.__name__, self.code)
|
||||
|
||||
|
@@ -22,6 +22,10 @@ class TestCountry(object):
|
||||
assert u'fi' == Country(u'fi')
|
||||
assert Country(u'fi') == Country(u'fi')
|
||||
|
||||
def test_non_equality_operator(self):
|
||||
assert Country(u'fi') != u'sv'
|
||||
assert not (Country(u'fi') != u'fi')
|
||||
|
||||
|
||||
class TestCountryType(TestCase):
|
||||
def create_models(self):
|
||||
|
Reference in New Issue
Block a user