diff options
author | Julien Danjou <julien@danjou.info> | 2015-11-18 13:08:18 +0100 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2015-11-18 13:08:18 +0100 |
commit | 33d30e3e304b85769555508783809184f56a75d0 (patch) | |
tree | 4350cd42b7db4251ebcd1256cdd28530074ca544 /iso8601 | |
parent | 3780ccd5e61e81397212a5215f2e4999066bad69 (diff) | |
download | pyiso8601-33d30e3e304b85769555508783809184f56a75d0.tar.gz |
Fix FixedOffset comparison
Fixes #19
Diffstat (limited to 'iso8601')
-rw-r--r-- | iso8601/iso8601.py | 4 | ||||
-rw-r--r-- | iso8601/test_iso8601.py | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/iso8601/iso8601.py b/iso8601/iso8601.py index c8284d4..59273e1 100644 --- a/iso8601/iso8601.py +++ b/iso8601/iso8601.py @@ -115,9 +115,7 @@ else: and (other.__name == self.__name) ) - if isinstance(other, tzinfo): - return other == self - return False + return NotImplemented def __getinitargs__(self): return (self.__offset_hours, self.__offset_minutes, self.__name) diff --git a/iso8601/test_iso8601.py b/iso8601/test_iso8601.py index bc5e763..0d01ffb 100644 --- a/iso8601/test_iso8601.py +++ b/iso8601/test_iso8601.py @@ -12,6 +12,10 @@ from iso8601 import iso8601 def test_iso8601_regex(): assert iso8601.ISO8601_REGEX.match("2006-10-11T00:14:33Z") +def test_fixedoffset_eq(): + # See https://bitbucket.org/micktwomey/pyiso8601/issues/19 + datetime.tzinfo() == iso8601.FixedOffset(2, 0, '+2:00') + def test_parse_no_timezone_different_default(): tz = iso8601.FixedOffset(2, 0, "test offset") d = iso8601.parse_date("2007-01-01T08:00:00", default_timezone=tz) |