Permalink
Browse files

Merge pull request #149 from sebatyler/master

Set default tz=None to astimezone method
2 parents 356bd07 + 9c472de commit a6653a3044dfc249c9741fcc20e7ee4b87c568db @spulec committed on GitHub Jul 10, 2016
Showing with 8 additions and 1 deletion.
  1. +1 −1 freezegun/api.py
  2. +7 −0 tests/test_operations.py
View
2 freezegun/api.py
@@ -169,7 +169,7 @@ def __sub__(self, other):
else:
return result
- def astimezone(self, tz):
+ def astimezone(self, tz=None):
if tz is None:
tz = tzlocal()
return datetime_to_fakedatetime(real_datetime.astimezone(self, tz))
View
7 tests/test_operations.py
@@ -78,6 +78,13 @@ def test_astimezone():
@freeze_time("2012-01-14 00:00:00")
+def test_astimezone_tz_none():
+ now = datetime.datetime.now(tz=GMT5())
+ converted = now.astimezone()
+ assert utils.is_fake_datetime(converted)
+
+
+@freeze_time("2012-01-14 00:00:00")
def test_replace():
now = datetime.datetime.now()
modified_time = now.replace(year=2013)

0 comments on commit a6653a3

Please sign in to comment.