12
12
from pandas .util import testing as tm
13
13
from pandas .util .testing import makeCustomDataframe as mkdf
14
14
15
+ from pandas .io .clipboard import clipboard_get , clipboard_set
15
16
from pandas .io .clipboard .exceptions import PyperclipException
16
17
17
18
try :
@@ -30,8 +31,8 @@ def build_kwargs(sep, excel):
30
31
return kwargs
31
32
32
33
33
- @pytest .fixture (params = ['delims' , 'utf8' , 'string ' , 'long ' , 'nonascii ' ,
34
- 'colwidth' , 'mixed' , 'float' , 'int' ])
34
+ @pytest .fixture (params = ['delims' , 'utf8' , 'utf16 ' , 'string ' , 'long ' ,
35
+ 'nonascii' , ' colwidth' , 'mixed' , 'float' , 'int' ])
35
36
def df (request ):
36
37
data_type = request .param
37
38
@@ -41,6 +42,10 @@ def df(request):
41
42
elif data_type == 'utf8' :
42
43
return pd .DataFrame ({'a' : ['µasd' , 'Ωœ∑´' ],
43
44
'b' : ['øπ∆˚¬' , 'œ∑´®' ]})
45
+ elif data_type == 'utf16' :
46
+ return pd .DataFrame ({'a' : ['\U0001f44d \U0001f44d ' ,
47
+ '\U0001f44d \U0001f44d ' ],
48
+ 'b' : ['abc' , 'def' ]})
44
49
elif data_type == 'string' :
45
50
return mkdf (5 , 3 , c_idx_type = 's' , r_idx_type = 'i' ,
46
51
c_idx_names = [None ], r_idx_names = [None ])
@@ -225,3 +230,14 @@ def test_invalid_encoding(self, df):
225
230
@pytest .mark .parametrize ('enc' , ['UTF-8' , 'utf-8' , 'utf8' ])
226
231
def test_round_trip_valid_encodings (self , enc , df ):
227
232
self .check_round_trip_frame (df , encoding = enc )
233
+
234
+
235
+ @pytest .mark .single
236
+ @pytest .mark .clipboard
237
+ @pytest .mark .skipif (not _DEPS_INSTALLED ,
238
+ reason = "clipboard primitives not installed" )
239
+ @pytest .mark .parametrize ('data' , [u'\U0001f44d ...' , u'Ωœ∑´...' , 'abcd...' ])
240
+ def test_raw_roundtrip (data ):
241
+ # PR #25040 wide unicode wasn't copied correctly on PY3 on windows
242
+ clipboard_set (data )
243
+ assert data == clipboard_get ()
0 commit comments