Permalink
Browse files

Merge branch 'master' of github.com:myusuf3/delorean

  • Loading branch information...
2 parents c6f4185 + 4e2899b commit 5a31af9830a729770e64a8c0dbd0a9a3f585e65d @myusuf3 committed Mar 16, 2013
Showing with 17 additions and 3 deletions.
  1. +6 −2 delorean/dates.py
  2. +1 −1 docs/index.rst
  3. +10 −0 tests/test_data.py
View
@@ -190,8 +190,12 @@ def __repr__(self):
return 'Delorean(datetime=%s, timezone=%s)' % (self._dt, self._tz)
def __eq__(self, other):
- # test this.
- return self._dt == other._dt and self._tz == other._tz
+ if isinstance(other, Delorean):
+ return self._dt == other._dt and self._tz == other._tz
+ return False
+
+ def __ne__(self, other):
+ return not self == other
def __getattr__(self, name):
"""
View
@@ -18,7 +18,7 @@ This document describes Delorean v\ |version|.
Delorean stands on the shoulders of giants `pytz <http://pytz.sourceforge.net/>`_ and `dateutil <http://labix.org/python-dateutil>`_
-`Delorean` will provide natural language improvements for manipulating time, as well as datetime abstractions for ease of use. The overall goal is to improve datetime manipulations, with a little bit of software and philsophy.
+`Delorean` will provide natural language improvements for manipulating time, as well as datetime abstractions for ease of use. The overall goal is to improve datetime manipulations, with a little bit of software and philosophy.
Pretty much make you a badass, time traveller.
View
@@ -7,6 +7,7 @@
from unittest import TestCase, main
from datetime import datetime, date, timedelta
+from copy import deepcopy
from pytz import timezone
import delorean
@@ -340,6 +341,15 @@ def test_epoch_creation(self):
do = delorean.epoch(1357187474.148546)
self.assertEqual(self.do, do)
+ def test_not_equal(self):
+ d = delorean.Delorean()
+ self.assertNotEqual(d, None)
+
+ def test_equal(self):
+ d1 = delorean.Delorean()
+ d2 = deepcopy(d1)
+ self.assertEqual(d1, d2)
+ self.assertFalse(d1 != d2, 'Overloaded __ne__ is not correct')
if __name__ == '__main__':
main()

0 comments on commit 5a31af9

Please sign in to comment.