66import pandas .util .testing as tm
77import pandas_datareader .data as web
88
9+ from pandas_datareader ._utils import PANDAS_0170
10+
911
1012class TestEurostat (tm .TestCase ):
1113
@@ -40,33 +42,29 @@ def test_get_cdh_e_fos(self):
4042 tm .assert_frame_equal (df , expected )
4143
4244 def test_get_sts_cobp_a (self ):
43-
44- raise nose .SkipTest ("This raises error because of data amount, "
45- "should be fixed in #149" )
46-
4745 # Building permits - annual data (2010 = 100)
4846 df = web .DataReader ('sts_cobp_a' , 'eurostat' ,
49- start = pd .Timestamp ('1992 -01-01' ),
47+ start = pd .Timestamp ('2000 -01-01' ),
5048 end = pd .Timestamp ('2013-01-01' ))
5149
52- idx = pd .date_range ('1992 -01-01' , '2013-01-01' , freq = 'AS' ,
50+ idx = pd .date_range ('2000 -01-01' , '2013-01-01' , freq = 'AS' ,
5351 name = 'TIME_PERIOD' )
54- ne_name = ('Building permits - m2 of useful floor area' ,
52+ ne_name = ('Index, 2010=100' ,
53+ 'Building permits - m2 of useful floor area' ,
5554 'Unadjusted data (i.e. neither seasonally adjusted nor calendar adjusted data)' ,
5655 'Non-residential buildings, except office buildings' ,
5756 'Netherlands' , 'Annual' )
58- ne_values = [np .nan , np .nan , np .nan , 144.53 , 136.97 , 180.02 , 198.36 ,
59- 215.12 , 200.05 , 186.46 , 127.33 , 130.67 , 143.26 , 147.83 ,
57+ ne_values = [200.05 , 186.46 , 127.33 , 130.67 , 143.26 , 147.83 ,
6058 176.69 , 227.36 , 199.45 , 128.49 , 100.0 , 113.83 , 89.33 ,
6159 77.57 ]
6260 ne = pd .Series (ne_values , name = ne_name , index = idx )
6361
64- uk_name = ('Building permits - m2 of useful floor area' ,
62+ uk_name = ('Index, 2010=100' ,
63+ 'Building permits - m2 of useful floor area' ,
6564 'Unadjusted data (i.e. neither seasonally adjusted nor calendar adjusted data)' ,
6665 'Non-residential buildings, except office buildings' ,
6766 'United Kingdom' , 'Annual' )
68- uk_values = [np .nan , np .nan , np .nan , np .nan , np .nan , np .nan , 120.37 ,
69- 115.93 , 112.53 , 113.32 , 110.18 , 112.14 , 119.06 , 112.66 ,
67+ uk_values = [112.53 , 113.32 , 110.18 , 112.14 , 119.06 , 112.66 ,
7068 113.05 , 121.8 , 113.97 , 105.88 , 100.0 , 98.56 , 103.69 ,
7169 81.32 ]
7270 uk = pd .Series (uk_values , name = uk_name , index = idx )
@@ -75,6 +73,39 @@ def test_get_sts_cobp_a(self):
7573 result = df [expected .name ]
7674 tm .assert_series_equal (result , expected )
7775
76+ def test_get_nrg_pc_202 (self ):
77+ # GH 149
78+
79+ if not PANDAS_0170 :
80+ raise nose .SkipTest ("skip because of comparison failure" )
81+
82+ df = web .DataReader ('nrg_pc_202' , 'eurostat' ,
83+ start = pd .Timestamp ('2010-01-01' ),
84+ end = pd .Timestamp ('2013-01-01' ))
85+
86+ name = ('All taxes and levies included' ,
87+ 'Gigajoules (Gross calorific value = GCV)' ,
88+ 'Euro' ,
89+ 'Band D1 : Consumption < 20 GJ' ,
90+ 'Natural gas' , 'Denmark' , 'Semi-annual' )
91+
92+ exp_index = pd .Index (['2013-B2' , '2013-B1' , '2012-B2' , '2012-B1' ,
93+ '2011-B2' , '2011-B1' , '2010-B2' , '2010-B1' ],
94+ name = 'TIME_PERIOD' )
95+ exp = pd .Series ([27.1403 , 27.5854 , 26.5285 , 27.2187 ,
96+ 28.5862 , 28.6448 , 26.8147 , 26.4979 ],
97+ index = exp_index , name = name )
98+ tm .assert_series_equal (df [name ], exp )
99+
100+ def test_get_prc_hicp_manr_exceeds_limit (self ):
101+ # GH 149
102+ msg = 'Query size exceeds maximum limit'
103+ with tm .assertRaisesRegexp (ValueError , msg ):
104+ web .DataReader ('prc_hicp_manr' , 'eurostat' ,
105+ start = pd .Timestamp ('2000-01-01' ),
106+ end = pd .Timestamp ('2013-01-01' ))
107+
108+
78109if __name__ == '__main__' :
79110 nose .runmodule (argv = [__file__ , '-vvs' , '-x' , '--pdb' , '--pdb-failure' ],
80111 exit = False )
0 commit comments