Skip to content

Commit

Permalink
Update quantum self-tests to take into account changes in dateutil.
Browse files Browse the repository at this point in the history
See
dateutil/dateutil#233 (comment)

Basically: dateutil used to parse 2013-03-01 as march 1, but due to a
change in 2.5.2, they decided to start parsing it as january 3. It's to
do with how they are trying to handle dates that look like yymmdd or
ddmmyy, etc, and they seem to think there is an obscure but valid case
where you'd want yyyyddmm. It's stupid but then relaxed parsing is a
minefield anyway.
  • Loading branch information
nigelmcnie committed Apr 30, 2017
1 parent 2fabe83 commit ed2a753
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions self_tests/support_quantum.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,24 @@ def applying_deltas():

@tests.test
def leap_years():
q = quantum.parse('2013-03-01', relaxed=True, timezone='UTC')
q = quantum.parse('01-03-2013', relaxed=True, timezone='UTC')
assert q.subtract(days=1).as_utc() == datetime(2013,2,28)

q = quantum.parse('2013-02-01', relaxed=True, timezone='UTC')
q = quantum.parse('01-02-2013', relaxed=True, timezone='UTC')
assert q.add(months=1).as_utc() == datetime(2013,3,1)

q = quantum.parse('2016-03-01', relaxed=True, timezone='UTC')
q = quantum.parse('01-03-2016', relaxed=True, timezone='UTC')
assert q.subtract(days=1).as_utc() == datetime(2016,2,29)

q = quantum.parse('2016-02-01', relaxed=True, timezone='UTC')
q = quantum.parse('01-02-2016', relaxed=True, timezone='UTC')
assert q.add(months=1).as_utc() == datetime(2016,3,1)

@tests.test
def formatting():
with Assert.raises(quantum.QuantumException):
quantum.now().format_date() == '1 Feb 2013'

q = quantum.parse('2013-02-01', relaxed=True, timezone='UTC')
q = quantum.parse('01-02-2013', relaxed=True, timezone='UTC')
assert q.format_date() == '1 Feb 2013'

if __name__ == '__main__':
Expand Down

0 comments on commit ed2a753

Please sign in to comment.