diff --git a/docs/index.rst b/docs/index.rst index eacc165..a277886 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 diff --git a/sqlalchemy_utils/types/country.py b/sqlalchemy_utils/types/country.py index b4c1efd..8618825 100644 --- a/sqlalchemy_utils/types/country.py +++ b/sqlalchemy_utils/types/country.py @@ -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) diff --git a/tests/types/test_country.py b/tests/types/test_country.py index 45ed25b..0e3d05b 100644 --- a/tests/types/test_country.py +++ b/tests/types/test_country.py @@ -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):