Skip to content

Commit

Permalink
Merge pull request #25 from crisscuola/add-dates_not_equal-method
Browse files Browse the repository at this point in the history
add dates_not_equal method
  • Loading branch information
trifonovmixail authored Dec 20, 2017
2 parents 22c56b0 + e7d7f1b commit 621abfd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions seismograph/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def dict_equal(self, d1, d2, msg=None):
"""
self.__unittest__.assertDictEqual(d1, d2, msg=msg)

def dates_equal(self, date1, date2):
def _dates_format(self, date1, date2):
"""
To compare dates. Date can be as string and date object.
Expand All @@ -400,11 +400,20 @@ def dates_equal(self, date1, date2):
from_string = lambda d: sum(sorted(int(i) for i in re.findall(r'[0-9]+', d)))

d1 = from_string(date1) if isinstance(date1, pyv.basestring) else from_date(date1)
d2 = from_string(date2) if isinstance(date2, basestring) else from_date(date2)
d2 = from_string(date2) if isinstance(date2, pyv.basestring) else from_date(date2)

return d1, d2

if d1 != d2:
def dates_equal(self, date1, date2):
dates = self._dates_format(date1, date2)
if dates[0] != dates[1]:
self.fail('{} != {}'.format(date1, date2))

def dates_not_equal(self, date1, date2):
dates = self._dates_format(date1, date2)
if dates[0] == dates[1]:
self.fail('{} = {}'.format(date1, date2))

def response(self,
resp,
status,
Expand Down

0 comments on commit 621abfd

Please sign in to comment.