@@ -59,6 +59,7 @@ def create_tempfile(path):
59
59
""" create an unopened named temporary file """
60
60
return os .path .join (tempfile .gettempdir (),path )
61
61
62
+
62
63
@contextmanager
63
64
def ensure_clean_store (path , mode = 'a' , complevel = None , complib = None ,
64
65
fletcher32 = False ):
@@ -77,6 +78,7 @@ def ensure_clean_store(path, mode='a', complevel=None, complib=None,
77
78
if mode == 'w' or mode == 'a' :
78
79
safe_remove (path )
79
80
81
+
80
82
@contextmanager
81
83
def ensure_clean_path (path ):
82
84
"""
@@ -95,6 +97,7 @@ def ensure_clean_path(path):
95
97
for f in filenames :
96
98
safe_remove (f )
97
99
100
+
98
101
# set these parameters so we don't have file sharing
99
102
tables .parameters .MAX_NUMEXPR_THREADS = 1
100
103
tables .parameters .MAX_BLOSC_THREADS = 1
@@ -256,7 +259,6 @@ def test_api(self):
256
259
self .assertRaises (TypeError , df .to_hdf , path ,'df' ,append = True ,format = 'foo' )
257
260
self .assertRaises (TypeError , df .to_hdf , path ,'df' ,append = False ,format = 'bar' )
258
261
259
-
260
262
def test_api_default_format (self ):
261
263
262
264
# default_format option
@@ -2257,7 +2259,6 @@ def test_remove_startstop(self):
2257
2259
expected = wp .reindex (major_axis = wp .major_axis - wp .major_axis [np .arange (0 ,20 ,3 )])
2258
2260
assert_panel_equal (result , expected )
2259
2261
2260
-
2261
2262
def test_remove_crit (self ):
2262
2263
2263
2264
with ensure_clean_store (self .path ) as store :
@@ -2517,7 +2518,7 @@ def test_backwards_compat_without_term_object(self):
2517
2518
result = store .select ('wp' , [('minor_axis' ,'=' ,['A' ,'B' ])])
2518
2519
expected = wp .loc [:,:,['A' ,'B' ]]
2519
2520
assert_panel_equal (result , expected )
2520
-
2521
+
2521
2522
def test_same_name_scoping (self ):
2522
2523
2523
2524
with ensure_clean_store (self .path ) as store :
@@ -3323,6 +3324,8 @@ def test_frame_select(self):
3323
3324
date = df .index [len (df ) // 2 ]
3324
3325
3325
3326
crit1 = Term ('index>=date' )
3327
+ self .assertEqual (crit1 .env .scope ['date' ], date )
3328
+
3326
3329
crit2 = ("columns=['A', 'D']" )
3327
3330
crit3 = ('columns=A' )
3328
3331
@@ -3776,7 +3779,6 @@ def test_select_as_multiple(self):
3776
3779
self .assertRaises (ValueError , store .select_as_multiple ,
3777
3780
['df1' ,'df3' ], where = ['A>0' , 'B>0' ], selector = 'df1' )
3778
3781
3779
-
3780
3782
def test_nan_selection_bug_4858 (self ):
3781
3783
3782
3784
# GH 4858; nan selection bug, only works for pytables >= 3.1
@@ -4227,6 +4229,7 @@ def test_query_with_nested_special_character(self):
4227
4229
result = store .select ('test' , 'a = "test & test"' )
4228
4230
tm .assert_frame_equal (expected , result )
4229
4231
4232
+
4230
4233
def _test_sort (obj ):
4231
4234
if isinstance (obj , DataFrame ):
4232
4235
return obj .reindex (sorted (obj .index ))
0 commit comments