Skip to content

Commit b50652a

Browse files
committed
MAINT: Correct bug in Quandl testing
1 parent 1e50626 commit b50652a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pandas_datareader/tests/test_quandl.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import os
22

33
import pytest
4+
import pandas as pd
45

56
from pandas_datareader import data as web
67
from pandas_datareader.compat import assert_frame_equal
78

9+
810
TEST_API_KEY = os.getenv("QUANDL_API_KEY")
911
# Ensure blank TEST_API_KEY not used in pull request
1012
TEST_API_KEY = None if not TEST_API_KEY else TEST_API_KEY
@@ -51,7 +53,7 @@ def test_db_wiki_us(self):
5153
"AdjVolume",
5254
],
5355
)
54-
assert df.Close.at[self.day10] == 7.70
56+
assert df.Close.at[pd.to_datetime(self.day10)] == 7.70
5557

5658
def test_db_fse_frankfurt(self):
5759
# ALV_X: Allianz SE
@@ -73,7 +75,7 @@ def test_db_fse_frankfurt(self):
7375
"DailyTurnover",
7476
],
7577
)
76-
assert df.Close.at[self.day10] == 159.45
78+
assert df.Close.at[pd.to_datetime(self.day10)] == 159.45
7779

7880
def test_fse_eon(self):
7981
# EON_X: E.on Se
@@ -95,7 +97,7 @@ def test_fse_eon(self):
9597
"High",
9698
],
9799
)
98-
assert df.Close.at[self.day2] == 14.03
100+
assert df.Close.at[pd.to_datetime(self.day2)] == 14.03
99101

100102
def test_db_euronext_be_fr_nl_pt(self):
101103
# FP: Total SA
@@ -105,7 +107,7 @@ def test_db_euronext_be_fr_nl_pt(self):
105107
"EURONEXT/FP", "quandl", self.start2, self.end2, api_key=TEST_API_KEY
106108
)
107109
self.check_headers(df, ["Open", "High", "Low", "Last", "Turnover", "Volume"])
108-
assert df.Last.at[self.day2] == 42.525
110+
assert df.Last.at[pd.to_datetime(self.day2)] == 42.525
109111
df2 = web.DataReader("FP.FR", "quandl", self.start2, self.end2)
110112
assert (df.Last == df2.Last).all()
111113

@@ -132,7 +134,7 @@ def test_hk_hsbc_uk(self):
132134
],
133135
)
134136
# as of 2017-06-11, Price == LastClose, all others are NaN
135-
assert df.NominalPrice.at[self.day2] == 74.0
137+
assert df.NominalPrice.at[pd.to_datetime(self.day2)] == 74.0
136138

137139
def test_db_nse_in(self):
138140
# TCS: Tata Consutancy Services
@@ -151,15 +153,15 @@ def test_db_nse_in(self):
151153
"TurnoverLacs",
152154
],
153155
)
154-
assert df.Close.at[self.day10] == 1259.05
156+
assert df.Close.at[pd.to_datetime(self.day10)] == 1259.05
155157

156158
def test_db_tse_jp(self):
157159
# TSE/6758: Sony Corp.
158160
df = web.DataReader(
159161
"TSE/6758", "quandl", self.start10, self.end10, api_key=TEST_API_KEY
160162
)
161163
self.check_headers(df, ["Open", "High", "Low", "Close", "Volume"])
162-
assert df.Close.at[self.day10] == 5190.0
164+
assert df.Close.at[pd.to_datetime(self.day10)] == 5190.0
163165

164166
df2 = web.get_data_quandl(
165167
"TSE/6758", self.start10, self.end10, api_key=TEST_API_KEY
@@ -188,4 +190,4 @@ def test_db_hkex_cn(self):
188190
"LotSize",
189191
],
190192
)
191-
assert df.High.at[self.day2] == 91.9
193+
assert df.High.at[pd.to_datetime(self.day2)] == 91.9

0 commit comments

Comments
 (0)