Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 7a35241

Browse files
committed
fix tests tz_localize
1 parent 318dabb commit 7a35241

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

influxdb/tests/dataframe_client_test.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -818,13 +818,15 @@ def test_query_into_dataframe(self):
818818
pd1 = pd.DataFrame(
819819
[[23422]], columns=['value'],
820820
index=pd.to_datetime(["2009-11-10T23:00:00Z"]))
821-
pd1.index = pd1.index.tz_localize('UTC')
821+
if pd1.index.tzinfo is None:
822+
pd1.index = pd1.index.tz_localize('UTC')
822823
pd2 = pd.DataFrame(
823824
[[23422], [23422], [23422]], columns=['value'],
824825
index=pd.to_datetime(["2009-11-10T23:00:00Z",
825826
"2009-11-10T23:00:00Z",
826827
"2009-11-10T23:00:00Z"]))
827-
pd2.index = pd2.index.tz_localize('UTC')
828+
if pd2.index.tzinfo is None:
829+
pd2.index = pd2.index.tz_localize('UTC')
828830
expected = {
829831
('network', (('direction', ''),)): pd1,
830832
('network', (('direction', 'in'),)): pd2
@@ -871,11 +873,14 @@ def test_multiquery_into_dataframe(self):
871873
index=pd.to_datetime([
872874
"2015-01-29 21:55:43.702900257+0000",
873875
"2015-01-29 21:55:43.702900257+0000",
874-
"2015-06-11 20:46:02+0000"])).tz_localize('UTC')
876+
"2015-06-11 20:46:02+0000"]))
877+
if pd1.index.tzinfo is None:
878+
pd1.index = pd1.index.tz_localize('UTC')
875879
pd2 = pd.DataFrame(
876880
[[3]], columns=['count'],
877-
index=pd.to_datetime(["1970-01-01 00:00:00+00:00"]))\
878-
.tz_localize('UTC')
881+
index=pd.to_datetime(["1970-01-01 00:00:00+00:00"]))
882+
if pd2.index.tzinfo is None:
883+
pd2.index = pd2.index.tz_localize('UTC')
879884
expected = [{'cpu_load_short': pd1}, {'cpu_load_short': pd2}]
880885

881886
cli = DataFrameClient('host', 8086, 'username', 'password', 'db')

0 commit comments

Comments
 (0)