File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ import os
1
2
from io import StringIO
2
3
3
4
import numpy as np
@@ -60,6 +61,30 @@ def open(*args):
60
61
assert_frame_equal (df1 , df2 )
61
62
62
63
64
+ @td .skip_if_no ("fastparquet" )
65
+ @td .skip_if_no ("gcsfs" )
66
+ def test_to_parquet_gcs_new_file (monkeypatch , tmpdir ):
67
+ """Regression test for writing to a not-yet-existent GCS Parquet file."""
68
+ df1 = DataFrame (
69
+ {
70
+ "int" : [1 , 3 ],
71
+ "float" : [2.0 , np .nan ],
72
+ "str" : ["t" , "s" ],
73
+ "dt" : date_range ("2018-06-18" , periods = 2 ),
74
+ }
75
+ )
76
+
77
+ class MockGCSFileSystem :
78
+ def open (self , path , mode = 'r' , * args ):
79
+ if 'w' not in mode :
80
+ raise FileNotFoundError
81
+ return open (os .path .join (tmpdir , 'test.parquet' ), mode )
82
+
83
+ monkeypatch .setattr ("gcsfs.GCSFileSystem" , MockGCSFileSystem )
84
+ df1 .to_parquet ("gs://test/test.csv" , index = True , engine = 'fastparquet' ,
85
+ compression = None )
86
+
87
+
63
88
@td .skip_if_no ("gcsfs" )
64
89
def test_gcs_get_filepath_or_buffer (monkeypatch ):
65
90
df1 = DataFrame (
You can’t perform that action at this time.
0 commit comments