26
26
(dt (2009 , 2 , 1 ), dt (2009 , 12 , 31 ), []),
27
27
(dt (2013 , 2 , 1 ), dt (2013 , 12 , 31 ), []),
28
28
])
29
- def should_return_libraries_for_the_given_daterange (toplevel_tickstore , start , end , expected ):
29
+ def test_should_return_libraries_for_the_given_daterange (toplevel_tickstore , start , end , expected ):
30
30
toplevel_tickstore ._collection .insert_one ({'start' : dt (2010 , 1 , 1 ),
31
31
'end' : dt (2010 , 12 , 31 , 23 , 59 , 59 ),
32
32
'library_name' : 'FEED_2010.LEVEL1' })
@@ -40,7 +40,7 @@ def should_return_libraries_for_the_given_daterange(toplevel_tickstore, start, e
40
40
assert libraries == expected
41
41
42
42
43
- def should_raise_exceptions_if_no_libraries_are_found_in_the_date_range_when_reading_data (toplevel_tickstore ):
43
+ def test_should_raise_exceptions_if_no_libraries_are_found_in_the_date_range_when_reading_data (toplevel_tickstore ):
44
44
toplevel_tickstore ._collection .insert_one ({'start' : dt (2010 , 1 , 1 ),
45
45
'end' : dt (2010 , 12 , 31 , 23 , 59 , 59 ),
46
46
'library_name' : 'FEED_2010.LEVEL1' })
@@ -49,24 +49,26 @@ def should_raise_exceptions_if_no_libraries_are_found_in_the_date_range_when_rea
49
49
assert "No underlying libraries exist for the given date range" in str (e )
50
50
51
51
52
- def should_return_data_when_date_range_falls_in_a_single_underlying_library (toplevel_tickstore , arctic ):
52
+ @pytest .mark .xfail
53
+ def test_should_return_data_when_date_range_falls_in_a_single_underlying_library (toplevel_tickstore , arctic ):
53
54
arctic .initialize_library ('FEED_2010.LEVEL1' , tickstore .TICK_STORE_TYPE )
54
- tickstore = arctic ['FEED_2010.LEVEL1' ]
55
+ tstore = arctic ['FEED_2010.LEVEL1' ]
55
56
arctic .initialize_library ('test_current.toplevel_tickstore' , tickstore .TICK_STORE_TYPE )
56
57
tickstore_current = arctic ['test_current.toplevel_tickstore' ]
57
58
toplevel_tickstore ._collection .insert_one ({'start' : dt (2010 , 1 , 1 ),
58
59
'end' : dt (2010 , 12 , 31 , 23 , 59 , 59 ),
59
60
'library_name' : 'FEED_2010.LEVEL1' })
60
61
dates = pd .date_range ('20100101' , periods = 6 , tz = mktz ('Europe/London' ))
61
62
df = pd .DataFrame (np .random .randn (6 , 4 ), index = dates , columns = list ('ABCD' ))
62
- tickstore .write ('blah' , df )
63
+ tstore .write ('blah' , df )
63
64
tickstore_current .write ('blah' , df )
64
65
res = toplevel_tickstore .read ('blah' , DateRange (start = dt (2010 , 1 , 1 ), end = dt (2010 , 1 , 6 )), list ('ABCD' ))
65
66
66
- assert_frame_equal (df , res .tz_localize (mktz ('Europe/London' )))
67
+ assert_frame_equal (df , res .tz_convert (mktz ('Europe/London' )))
67
68
68
69
69
- def should_return_data_when_date_range_spans_libraries (toplevel_tickstore , arctic ):
70
+ @pytest .mark .xfail
71
+ def test_should_return_data_when_date_range_spans_libraries (toplevel_tickstore , arctic ):
70
72
arctic .initialize_library ('FEED_2010.LEVEL1' , tickstore .TICK_STORE_TYPE )
71
73
arctic .initialize_library ('FEED_2011.LEVEL1' , tickstore .TICK_STORE_TYPE )
72
74
tickstore_2010 = arctic ['FEED_2010.LEVEL1' ]
@@ -85,30 +87,31 @@ def should_return_data_when_date_range_spans_libraries(toplevel_tickstore, arcti
85
87
tickstore_2011 .write ('blah' , df_11 )
86
88
res = toplevel_tickstore .read ('blah' , DateRange (start = dt (2010 , 1 , 2 ), end = dt (2011 , 1 , 4 )), list ('ABCD' ))
87
89
expected_df = pd .concat ([df_10 [1 :], df_11 [:4 ]])
88
- assert_frame_equal (expected_df , res .tz_localize (mktz ('Europe/London' )))
90
+ assert_frame_equal (expected_df , res .tz_convert (mktz ('Europe/London' )))
89
91
90
92
91
- def should_add_underlying_library_where_none_exists (toplevel_tickstore , arctic ):
93
+ def test_should_add_underlying_library_where_none_exists (toplevel_tickstore , arctic ):
92
94
arctic .initialize_library ('FEED_2010.LEVEL1' , tickstore .TICK_STORE_TYPE )
93
95
toplevel_tickstore .add (DateRange (start = dt (2010 , 1 , 1 ), end = dt (2010 , 12 , 31 , 23 , 59 , 59 , 999000 )), 'FEED_2010.LEVEL1' )
94
96
assert toplevel_tickstore ._collection .find_one ({'library_name' : 'FEED_2010.LEVEL1' })
95
97
96
98
97
- def should_add_underlying_library_where_another_library_exists_in_a_non_overlapping_daterange (toplevel_tickstore , arctic ):
99
+ @pytest .mark .xfail
100
+ def test_should_add_underlying_library_where_another_library_exists_in_a_non_overlapping_daterange (toplevel_tickstore , arctic ):
98
101
toplevel_tickstore ._collection .insert_one ({'library_name' : 'FEED_2011.LEVEL1' , 'start' : dt (2011 , 1 , 1 ), 'end' : dt (2011 , 12 , 31 )})
99
102
arctic .initialize_library ('FEED_2010.LEVEL1' , tickstore .TICK_STORE_TYPE )
100
103
toplevel_tickstore .add (DateRange (start = dt (2010 , 1 , 1 ), end = dt (2010 , 12 , 31 , 23 , 59 , 59 , 999000 )), 'FEED_2010.LEVEL1' )
101
104
assert set ([ res ['library_name' ] for res in toplevel_tickstore ._collection .find ()]) == set (['FEED_2010.LEVEL1' , 'FEED_2011.LEVEL1' ])
102
105
103
106
104
- def should_raise_exception_if_library_does_not_exist (toplevel_tickstore ):
107
+ def test_should_raise_exception_if_library_does_not_exist (toplevel_tickstore ):
105
108
with pytest .raises (LibraryNotFoundException ) as e :
106
109
toplevel_tickstore .add (DateRange (start = dt (2010 , 1 , 1 ), end = dt (2010 , 12 , 31 , 23 , 59 , 59 , 999000 )), 'FEED_2010.LEVEL1' )
107
110
assert toplevel_tickstore ._collection .find_one ({'library_name' : 'FEED_2010.LEVEL1' })
108
111
assert "Library FEED_2010.LEVEL1 was not correctly initialized" in str (e )
109
112
110
113
111
- def should_raise_exception_if_date_range_for_library_overlaps_with_existing_libraries (toplevel_tickstore , arctic ):
114
+ def test_should_raise_exception_if_date_range_for_library_overlaps_with_existing_libraries (toplevel_tickstore , arctic ):
112
115
toplevel_tickstore ._collection .insert_one ({'library_name' : 'FEED_2010.LEVEL1' , 'start' : dt (2010 , 1 , 1 ), 'end' : dt (2010 , 6 , 30 )})
113
116
arctic .initialize_library ('FEED_2010a.LEVEL1' , tickstore .TICK_STORE_TYPE )
114
117
with pytest .raises (OverlappingDataException ) as e :
@@ -117,7 +120,8 @@ def should_raise_exception_if_date_range_for_library_overlaps_with_existing_libr
117
120
assert "There are libraries that overlap with the date range:" in str (e )
118
121
119
122
120
- def should_successfully_do_a_roundtrip_write_and_read_spanning_multiple_underlying_libraries (toplevel_tickstore , arctic ):
123
+ @pytest .mark .xfail
124
+ def test_should_successfully_do_a_roundtrip_write_and_read_spanning_multiple_underlying_libraries (toplevel_tickstore , arctic ):
121
125
arctic .initialize_library ('FEED_2010.LEVEL1' , tickstore .TICK_STORE_TYPE )
122
126
arctic .initialize_library ('FEED_2011.LEVEL1' , tickstore .TICK_STORE_TYPE )
123
127
arctic .initialize_library ('test_current.toplevel_tickstore' , tickstore .TICK_STORE_TYPE )
@@ -129,7 +133,7 @@ def should_successfully_do_a_roundtrip_write_and_read_spanning_multiple_underlyi
129
133
toplevel_tickstore .write ('blah' , data )
130
134
tickstore_current .write ('blah' , data )
131
135
res = toplevel_tickstore .read ('blah' , DateRange (start = dt (2010 , 12 , 1 ), end = dt (2011 , 2 , 1 )), columns = list ('ABCD' ))
132
- assert_frame_equal (data , res .tz_localize (mktz ('Europe/London' )))
136
+ assert_frame_equal (data , res .tz_convert (mktz ('Europe/London' )))
133
137
lib2010 = arctic ['FEED_2010.LEVEL1' ]
134
138
res = lib2010 .read ('blah' , DateRange (start = dt (2010 , 12 , 1 ), end = dt (2011 , 1 , 1 )), columns = list ('ABCD' ))
135
139
assert_frame_equal (data [dt (2010 , 12 , 1 ): dt (2010 , 12 , 31 )], res .tz_localize (mktz ('Europe/London' )))
@@ -143,7 +147,7 @@ def should_successfully_do_a_roundtrip_write_and_read_spanning_multiple_underlyi
143
147
(dt (2010 , 1 , 1 ), dt (2010 , 12 , 31 ), 0 , 8 ),
144
148
(dt (2011 , 1 , 1 ), dt (2011 , 12 , 31 ), 7 , 10 ),
145
149
])
146
- def should_list_symbols_from_the_underlying_library (toplevel_tickstore , arctic , start , end , startr , endr ):
150
+ def test_should_list_symbols_from_the_underlying_library (toplevel_tickstore , arctic , start , end , startr , endr ):
147
151
arctic .initialize_library ('FEED_2010.LEVEL1' , tickstore .TICK_STORE_TYPE )
148
152
arctic .initialize_library ('FEED_2011.LEVEL1' , tickstore .TICK_STORE_TYPE )
149
153
toplevel_tickstore .add (DateRange (start = dt (2010 , 1 , 1 ), end = dt (2010 , 12 , 31 , 23 , 59 , 59 , 999000 )), 'FEED_2010.LEVEL1' )
@@ -158,7 +162,7 @@ def should_list_symbols_from_the_underlying_library(toplevel_tickstore, arctic,
158
162
assert expected_symbols == toplevel_tickstore .list_symbols (DateRange (start = start , end = end ))
159
163
160
164
161
- def should_add_underlying_libraries_when_intialized (arctic ):
165
+ def test_should_add_underlying_libraries_when_intialized (arctic ):
162
166
arctic .initialize_library ('FEED_2010.LEVEL1' , tickstore .TICK_STORE_TYPE )
163
167
arctic .initialize_library ('FEED_2011.LEVEL1' , tickstore .TICK_STORE_TYPE )
164
168
arctic .initialize_library ('FEED.LEVEL1' , toplevel .TICK_STORE_TYPE )
0 commit comments