zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
U
­ý°doŒã @sddlmZddlmZmZddlZddlZddlZddl    m
m Z ddl mZmZmZddlmZddlmZddlmZddlmZedd    d
gd d d gd ejdgdœƒZeddddddddgddddddddgddddddddgdddd d!d"d#d$gd%œƒZd&Zd'd(„Zejd)d*gd+d,d-„ƒZ ejej!d.e  "d.¡d/d0gd+d1d2„ƒZ#d3d4„Z$d5d6„Z%d7d8„Z&d9d:„Z'd;d<„Z(d=d>„Z)ej* +d?e,e-d@dAƒƒdBdC„e-d@dAƒDƒg¡dDdE„ƒZ.dFZ/dGdH„Z0dIdJ„Z1dKdL„Z2dMdN„Z3dOdP„Z4dQdR„Z5dSdT„Z6dUdV„Z7dWdX„Z8dYdZ„Z9d[d\„Z:d]d^„Z;d_d`„Z<dadb„Z=dcdd„Z>dedf„Z?dgdh„Z@didj„ZAdkdl„ZBdmZCdndo„ZDe  "d.¡dpdq„ƒZEe  "d.¡ej* +drdsdtdug¡dvdw„ƒƒZFdxdy„ZGe  "d.¡dzd{„ƒZHd|d}„ZId~d„ZJe  Kd.¡d€d„ƒZLd‚dƒ„ZMd„ZNe  "d.¡d…d†„ƒZOe  "d.¡d‡dˆ„ƒZPe  "d.¡d‰dŠ„ƒZQe  "d.¡d‹dŒ„ƒZRe  "d.¡ej* +ddŽdg¡dd‘„ƒƒZSe  "d.¡d’d“„ƒZTe  "d.¡d”d•„ƒZUe  "d.¡d–d—„ƒZVd˜d™„ZWe  "d.¡dšd›„ƒZXe  "d.¡dœd„ƒZYe  "d.¡dždŸ„ƒZZdFZ[d d¡„Z\d¢d£„Z]d¤d¥„Z^d¦d§„Z_ej*j`e  "d¨¡e  "d.¡d©dª„ƒƒƒZadS)«é)Ú annotations)ÚBytesIOÚStringION)ÚNAÚ    DataFrameÚIndex)Ú_compression_to_extension)Ú
get_handle)Úread_xmlZsquareZcircleZtriangleihé´éé)ÚshapeÚdegreesÚsidesZMercuryZVenusZEarthZMarsZJupiterZSaturnZUranusZNeptuneZ terrestrialz    gas giantz    ice giantÚinnerÚouterg`é|x– Õ?gc AJx@g2rö´ã@gl®šçˆä?gh‘í|¿¨@gÞ    ŠÂ@gd]ÜF´U@g•Ô    hšY@)ZplanetÚtypeÚlocationÚmassac<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <index>0</index>
    <category>cooking</category>
    <title>Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.0</price>
  </row>
  <row>
    <index>1</index>
    <category>children</category>
    <title>Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
  </row>
  <row>
    <index>2</index>
    <category>web</category>
    <title>Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </row>
</data>cCs|dk    r| dd¡}|S)Nz%<?xml version="1.0" encoding="utf-8"?z%<?xml version='1.0' encoding='utf-8'?)Úreplace)Údoc©rúVd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/io/xml/test_to_xml.pyÚ equalize_declŽs þrÚrbÚr)ÚparamscCs|jS©N©Úparam©ÚrequestrrrÚmode™sr#Úlxml)ZmarksÚetreecCs|jSrrr!rrrÚparseržsr&c
Cs~|ddddƒ}t||d}t d¡P}|j||dt|dƒ}| ¡ d¡ ¡}W5QRXt|ƒ}|t    kspt
‚W5QRXdS©    NÚioÚdataÚxmlú    books.xml©r&útest.xmlrúutf-8© r
ÚtmÚ ensure_cleanÚto_xmlÚopenÚreadÚdecodeÚstriprÚfrom_file_expectedÚAssertionError©Údatapathr&ÚfilenameÚdf_fileÚpathÚfÚoutputrrrÚtest_file_output_str_read¦s   r@c
Cs~|ddddƒ}t||d}t d¡P}|j||dt|dƒ}| ¡ d¡ ¡}W5QRXt|ƒ}|t    kspt
‚W5QRXdSr'r/r9rrrÚtest_file_output_bytes_read´s   rAcCs>|ddddƒ}t||d}|j|d}t|ƒ}|tks:t‚dS)Nr(r)r*r+r,)r
r2rr7r8©r:r&r;r<r?rrrÚtest_str_outputÂs
  rCc    Cs0d}tjtddtj||dW5QRXdS)Nz/my/fake/path/output.xmlz6Cannot save file into a non-existent directory: .*path©Úmatchr,)ÚpytestÚraisesÚOSErrorÚgeom_dfr2©r&r=rrrÚtest_wrong_file_pathÌs þrKc
Cs„d}|ddddƒ}t||d}t d¡R}|j|d|d    t|d
ƒ}| ¡ d ¡ ¡}W5QRXt|ƒ}||ksvt    ‚W5QRXdS) Na$<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <category>cooking</category>
    <title>Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.0</price>
  </row>
  <row>
    <category>children</category>
    <title>Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
  </row>
  <row>
    <category>web</category>
    <title>Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </row>
</data>r(r)r*r+r,r-F©Úindexr&rr.©
r
r0r1r2r3r4r5r6rr8©r:r&Úexpectedr;r<r=r>r?rrrÚtest_index_falseÙs   rQc
Csˆd}|ddddƒ}t||d}t d¡V}|j|dd    d
|d t|d ƒ}| ¡ d ¡ ¡}W5QRXt|ƒ}||kszt    ‚W5QRXdS)Na,<?xml version='1.0' encoding='utf-8'?>
<books>
  <book>
    <category>cooking</category>
    <title>Everyday Italian</title>
    <author>Giada De Laurentiis</author>
    <year>2005</year>
    <price>30.0</price>
  </book>
  <book>
    <category>children</category>
    <title>Harry Potter</title>
    <author>J K. Rowling</author>
    <year>2005</year>
    <price>29.99</price>
  </book>
  <book>
    <category>web</category>
    <title>Learning XML</title>
    <author>Erik T. Ray</author>
    <year>2003</year>
    <price>39.95</price>
  </book>
</books>r(r)r*r+r,r-FZbooksZbook)rMZ    root_nameZrow_namer&rr.rNrOrrrÚ test_index_false_rename_row_roots  ÿ rRÚ offset_indexé
é cCsg|] }t|ƒ‘qSr)Ústr)Ú.0ÚirrrÚ
<listcomp>,srYcCs<d}t ¡}t|ƒ|_|jd|d}t|ƒ}||ks8t‚dS)z®
    Tests that the output does not contain the `<index>` field when the index of the
    input Dataframe has an offset.
 
    This is a regression test for issue #42458.
    aD<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <shape>square</shape>
    <degrees>360</degrees>
    <sides>4.0</sides>
  </row>
  <row>
    <shape>circle</shape>
    <degrees>360</degrees>
    <sides/>
  </row>
  <row>
    <shape>triangle</shape>
    <degrees>180</degrees>
    <sides>3.0</sides>
  </row>
</data>FrLN)rIÚcopyrrMr2rr8)r&rSrPZoffset_geom_dfr?rrrÚ(test_index_false_with_offset_input_index+s 
r[aƒ<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <index>0</index>
    <shape>square</shape>
    <degrees>360</degrees>
    <sides>4.0</sides>
  </row>
  <row>
    <index>1</index>
    <shape>circle</shape>
    <degrees>360</degrees>
    <sides/>
  </row>
  <row>
    <index>2</index>
    <shape>triangle</shape>
    <degrees>180</degrees>
    <sides>3.0</sides>
  </row>
</data>cCs$tj|d}t|ƒ}|tks t‚dS)Nr,©rIr2rÚ na_expectedr8©r&r?rrrÚtest_na_elem_outputls r_cCs&tjd|d}t|ƒ}|tks"t‚dS)NÚ©Úna_repr&r\r^rrrÚtest_na_empty_str_elem_optionssrccCs*d}tjd|d}t|ƒ}||ks&t‚dS)Na<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <index>0</index>
    <shape>square</shape>
    <degrees>360</degrees>
    <sides>4.0</sides>
  </row>
  <row>
    <index>1</index>
    <shape>circle</shape>
    <degrees>360</degrees>
    <sides>0.0</sides>
  </row>
  <row>
    <index>2</index>
    <shape>triangle</shape>
    <degrees>180</degrees>
    <sides>3.0</sides>
  </row>
</data>z0.0ra©rIr2rr8©r&rPr?rrrÚtest_na_empty_elem_optionzsrfcCs0d}tjdddg|d}t|ƒ}||ks,t‚dS)Nzß<?xml version='1.0' encoding='utf-8'?>
<data>
  <row index="0" shape="square" degrees="360" sides="4.0"/>
  <row index="1" shape="circle" degrees="360"/>
  <row index="2" shape="triangle" degrees="180" sides="3.0"/>
</data>rrr©Ú    attr_colsr&rdrerrrÚtest_attrs_cols_nan_output›sricCs:d}tjddddgddid|d}t|ƒ}||ks6t‚dS)    Na><?xml version='1.0' encoding='utf-8'?>
<doc:data xmlns:doc="http://example.xom">
  <doc:row doc:index="0" doc:shape="square" doc:degrees="360" doc:sides="4.0"/>
  <doc:row doc:index="1" doc:shape="circle" doc:degrees="360"/>
  <doc:row doc:index="2" doc:shape="triangle" doc:degrees="180" doc:sides="3.0"/>
</doc:data>rMrrrrzhttp://example.xom)rhÚ
namespacesÚprefixr&rdrerrrÚtest_attrs_cols_prefixªs 
ürlc    Cs2tjtddtjdddg|dW5QRXdS)Núno valid columnrDrÚdegreerrg©rFrGÚKeyErrorrIr2r,rrrÚtest_attrs_unknown_columnÁsrqc    Cs,tjtddtjd|dW5QRXdS)Nz!is not a valid type for attr_colsrDú"shape", "degree", "sides"rg©rFrGÚ    TypeErrorrIr2r,rrrÚtest_attrs_wrong_typeÆsrucCs2d}tjddddg|d}t|ƒ}||ks.t‚dS)NaD<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <degrees>360</degrees>
    <sides>4.0</sides>
    <shape>square</shape>
  </row>
  <row>
    <degrees>360</degrees>
    <sides/>
    <shape>circle</shape>
  </row>
  <row>
    <degrees>180</degrees>
    <sides>3.0</sides>
    <shape>triangle</shape>
  </row>
</data>Frrr)rMÚ    elem_colsr&rd©r&Zelems_cols_expectedr?rrrÚtest_elems_cols_nan_outputÎsÿrxc    Cs2tjtddtjdddg|dW5QRXdS)NrmrDrrnr©rvr&ror,rrrÚtest_elems_unknown_columnësrzc    Cs,tjtddtjd|dW5QRXdS)Nz!is not a valid type for elem_colsrDrrryrsr,rrrÚtest_elems_wrong_typeðsr{cCs4d}tjdddgdg|d}t|ƒ}||ks0t‚dS)Na#<?xml version='1.0' encoding='utf-8'?>
<data>
  <row shape="square">
    <degrees>360</degrees>
    <sides>4.0</sides>
  </row>
  <row shape="circle">
    <degrees>360</degrees>
    <sides/>
  </row>
  <row shape="triangle">
    <degrees>180</degrees>
    <sides>3.0</sides>
  </row>
</data>Frrr)rMrvrhr&rdrwrrrÚtest_elems_and_attrs_colsõsür|cCsJd}tjddgddddgdd     d
¡}|j|d }t|ƒ}||ksFt‚dS) NaÔ<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <location>inner</location>
    <type>terrestrial</type>
    <count_mass>4</count_mass>
    <sum_mass>11.81</sum_mass>
    <mean_mass>2.95</mean_mass>
  </row>
  <row>
    <location>outer</location>
    <type>gas giant</type>
    <count_mass>2</count_mass>
    <sum_mass>2466.5</sum_mass>
    <mean_mass>1233.25</mean_mass>
  </row>
  <row>
    <location>outer</location>
    <type>ice giant</type>
    <count_mass>2</count_mass>
    <sum_mass>189.23</sum_mass>
    <mean_mass>94.61</mean_mass>
  </row>
  <row>
    <location>All</location>
    <type/>
    <count_mass>8</count_mass>
    <sum_mass>2667.54</sum_mass>
    <mean_mass>333.44</mean_mass>
  </row>
</data>rrrÚcountÚsumÚmeanT©rMÚvaluesZaggfuncZmarginsér,)Ú    planet_dfÚ pivot_tableÚroundr2rr8©r&rPZpvtr?rrrÚtest_hierarchical_columnss!üû r‡cCsXd}tjddgddddgdd     d
¡}|jt| ¡jjƒ|d }t|ƒ}||ksTt    ‚dS) Na¦<?xml version='1.0' encoding='utf-8'?>
<data>
  <row location="inner" type="terrestrial" count_mass="4" sum_mass="11.81" mean_mass="2.95"/>
  <row location="outer" type="gas giant" count_mass="2" sum_mass="2466.5" mean_mass="1233.25"/>
  <row location="outer" type="ice giant" count_mass="2" sum_mass="189.23" mean_mass="94.61"/>
  <row location="All" type="" count_mass="8" sum_mass="2667.54" mean_mass="333.44"/>
</data>rrrr}r~rTr€r‚rg)
rƒr„r…r2ÚlistÚ reset_indexÚcolumnsrrr8r†rrrÚtest_hierarchical_attrs_columnsDs üûr‹cCsLd}t ddg¡d dddg¡ d¡}|j|d    }t|ƒ}||ksHt‚dS)
NaÞ<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <location>inner</location>
    <type>terrestrial</type>
    <count>4</count>
    <sum>11.81</sum>
    <mean>2.95</mean>
  </row>
  <row>
    <location>outer</location>
    <type>gas giant</type>
    <count>2</count>
    <sum>2466.5</sum>
    <mean>1233.25</mean>
  </row>
  <row>
    <location>outer</location>
    <type>ice giant</type>
    <count>2</count>
    <sum>189.23</sum>
    <mean>94.61</mean>
  </row>
</data>rrrr}r~rr‚r,)rƒÚgroupbyÚaggr…r2rr8©r&rPrr?rrrÚtest_multi_indexbsÿþÿ rcCsZd}t ddg¡d dddg¡ d¡}|jt| ¡jjƒ|d    }t    |ƒ}||ksVt
‚dS)
Na$<?xml version='1.0' encoding='utf-8'?>
<data>
  <row location="inner" type="terrestrial" count="4" sum="11.81" mean="2.95"/>
  <row location="outer" type="gas giant" count="2" sum="2466.5" mean="1233.25"/>
  <row location="outer" type="ice giant" count="2" sum="189.23" mean="94.61"/>
</data>rrrr}r~rr‚rg) rƒrŒrr…r2rˆr‰rŠrrr8rŽrrrÚtest_multi_index_attrs_cols‰s ÿþÿrcCs.d}tjddi|d}t|ƒ}||ks*t‚dS)Naž<?xml version='1.0' encoding='utf-8'?>
<data xmlns="http://example.com">
  <row>
    <index>0</index>
    <shape>square</shape>
    <degrees>360</degrees>
    <sides>4.0</sides>
  </row>
  <row>
    <index>1</index>
    <shape>circle</shape>
    <degrees>360</degrees>
    <sides/>
  </row>
  <row>
    <index>2</index>
    <shape>triangle</shape>
    <degrees>180</degrees>
    <sides>3.0</sides>
  </row>
</data>r`úhttp://example.com)rjr&rdrerrrÚtest_default_namespace£sr’cCs0d}tjddid|d}t|ƒ}||ks,t‚dS)Na<?xml version='1.0' encoding='utf-8'?>
<doc:data xmlns:doc="http://example.com">
  <doc:row>
    <doc:index>0</doc:index>
    <doc:shape>square</doc:shape>
    <doc:degrees>360</doc:degrees>
    <doc:sides>4.0</doc:sides>
  </doc:row>
  <doc:row>
    <doc:index>1</doc:index>
    <doc:shape>circle</doc:shape>
    <doc:degrees>360</doc:degrees>
    <doc:sides/>
  </doc:row>
  <doc:row>
    <doc:index>2</doc:index>
    <doc:shape>triangle</doc:shape>
    <doc:degrees>180</doc:degrees>
    <doc:sides>3.0</doc:sides>
  </doc:row>
</doc:data>rr‘©rjrkr&rdrerrrÚtest_namespace_prefixÄsÿr”c    Cs2tjtddtjddid|dW5QRXdS)Nz!doc is not included in namespacesrDr`r‘rr“ror,rrrÚtest_missing_prefix_in_nmspäs ÿr•cCsFd}tjdddœd|d}t|ƒ}|dk    r6| dd¡}||ksBt‚dS)    Na7<?xml version='1.0' encoding='utf-8'?>
<doc:data xmlns="http://example.com" xmlns:doc="http://other.org">
  <doc:row>
    <doc:index>0</doc:index>
    <doc:shape>square</doc:shape>
    <doc:degrees>360</doc:degrees>
    <doc:sides>4.0</doc:sides>
  </doc:row>
  <doc:row>
    <doc:index>1</doc:index>
    <doc:shape>circle</doc:shape>
    <doc:degrees>360</doc:degrees>
    <doc:sides/>
  </doc:row>
  <doc:row>
    <doc:index>2</doc:index>
    <doc:shape>triangle</doc:shape>
    <doc:degrees>180</doc:degrees>
    <doc:sides>3.0</doc:sides>
  </doc:row>
</doc:data>r‘zhttp://other.org)r`rrr“z7xmlns:doc="http://other.org" xmlns="http://example.com"z7xmlns="http://example.com" xmlns:doc="http://other.org"©rIr2rrr8rerrrÚ!test_namespace_prefix_and_defaultësýþr—u«<?xml version='1.0' encoding='ISO-8859-1'?>
<data>
  <row>
    <index>0</index>
    <rank>1</rank>
    <malename>José</malename>
    <femalename>Sofía</femalename>
  </row>
  <row>
    <index>1</index>
    <rank>2</rank>
    <malename>Luis</malename>
    <femalename>Valentina</femalename>
  </row>
  <row>
    <index>2</index>
    <rank>3</rank>
    <malename>Carlos</malename>
    <femalename>Isabella</femalename>
  </row>
  <row>
    <index>3</index>
    <rank>4</rank>
    <malename>Juan</malename>
    <femalename>Camila</femalename>
  </row>
  <row>
    <index>4</index>
    <rank>5</rank>
    <malename>Jorge</malename>
    <femalename>Valeria</femalename>
  </row>
</data>cCsT|ddddƒ}t||dd d¡}|jd|d}|dk    rD| d    d
¡}|tksPt‚dS) Nr(r)r*úbaby_names.xmlú
ISO-8859-1)r&Úencodingé©ršr&z*<?xml version="1.0" encoding="ISO-8859-1"?z*<?xml version='1.0' encoding='ISO-8859-1'?)r
Úheadr2rÚencoding_expectedr8rBrrrÚtest_encoding_option_str:sþrŸc    CsH|ddddƒ}t|ddd}t d¡}|j|d    ddd
W5QRXdS© Nr(r)r*r˜r™r$rœr-F)rMršr&©r
r0r1r2)r:r;r<r=rrrÚtest_correct_encoding_fileJs r¢ršzUTF-8zUTF-16r™c    CsH|ddddƒ}t|ddd}t d¡}|j|d    ||d
W5QRXdSr r¡)r:r&ršr;r<r=rrrÚtest_wrong_encoding_option_lxmlSs r£c    Cs,tjtddtjd|dW5QRXdS)Nzunknown encodingrDzuft-8rœ)rFrGÚ LookupErrorrIr2r,rrrÚtest_misspelled_encoding]sr¥cCs d}tjdd}||kst‚dS)Na\<data>
  <row>
    <index>0</index>
    <shape>square</shape>
    <degrees>360</degrees>
    <sides>4.0</sides>
  </row>
  <row>
    <index>1</index>
    <shape>circle</shape>
    <degrees>360</degrees>
    <sides/>
  </row>
  <row>
    <index>2</index>
    <shape>triangle</shape>
    <degrees>180</degrees>
    <sides>3.0</sides>
  </row>
</data>F)Úxml_declaration)rIr2r8)rPr?rrrÚ!test_xml_declaration_pretty_printes r§cCs>d}tjd|d}t|ƒ}|dk    r.| dd¡}||ks:t‚dS)Na4<?xml version='1.0' encoding='utf-8'?>
<data><row><index>0</index><shape>square</shape><degrees>360</degrees><sides>4.0</sides></row><row><index>1</index><shape>circle</shape><degrees>360</degrees><sides/></row><row><index>2</index><shape>triangle</shape><degrees>180</degrees><sides>3.0</sides></row></data>F)Ú pretty_printr&ú />ú/>r–rerrrÚtest_no_pretty_print_with_decl‚sÿ
 r«cCs8d}tjdd|d}|dk    r(| dd¡}||ks4t‚dS)Na <data><row><index>0</index><shape>square</shape><degrees>360</degrees><sides>4.0</sides></row><row><index>1</index><shape>circle</shape><degrees>360</degrees><sides/></row><row><index>2</index><shape>triangle</shape><degrees>180</degrees><sides>3.0</sides></row></data>F)r¦r¨r&r©rª)rIr2rr8rerrrÚtest_no_pretty_print_no_decl—s ÿ     r¬c    Cs&tjtddt ¡W5QRXdS)Nz7lxml not found, please install or use the etree parser.rD)rFrGÚ ImportErrorrIr2rrrrÚtest_default_parser_no_lxml­s
ÿr®c    Cs*tjtddtjddW5QRXdS)Nz,Values for parser can only be lxml or etree.rDZbs4r,©rFrGÚ
ValueErrorrIr2rrrrÚtest_unknown_parserµs
ÿr±a%<?xml version="1.0" encoding="utf-8"?>
<data>
  <row>
    <field field="index">0</field>
    <field field="shape">square</field>
    <field field="degrees">360</field>
    <field field="sides">4.0</field>
  </row>
  <row>
    <field field="index">1</field>
    <field field="shape">circle</field>
    <field field="degrees">360</field>
    <field field="sides"/>
  </row>
  <row>
    <field field="index">2</field>
    <field field="shape">triangle</field>
    <field field="degrees">180</field>
    <field field="sides">3.0</field>
  </row>
</data>c    Cs<|ddddƒ}t||ƒ}tj|dtks.t‚W5QRXdS©Nr(r)r*úrow_field_output.xsl©Ú
stylesheet)r3rIr2Ú xsl_expectedr8)r:r#Úxslr>rrrÚtest_stylesheet_file_likeÖs r¸c    Csb|ddddƒ}t||ƒ(}|dkr0t| ¡ƒ}n t| ¡ƒ}W5QRXtj|d}|tks^t‚dS)Nr(r)r*r³rr´)r3rr4rrIr2r¶r8)r:r#Zxsl_pathr>Úxsl_objr?rrrÚtest_stylesheet_ioÞs  rºc    CsH|ddddƒ}t||ƒ}| ¡}W5QRXtj|d}|tksDt‚dSr²)r3r4rIr2r¶r8)r:r#r·r>r¹r?rrrÚtest_stylesheet_buffered_readerïs
  r»c    CsFddlm}tj ddd¡}tj|ddtj|dW5QRXdS)    Nr©ÚXMLSyntaxErrorr)r*zrow_field_output.xsltú!Start tag expected, '<' not foundrDr´)    Ú
lxml.etreer½Úosr=ÚjoinrFrGrIr2©r½r·rrrÚtest_stylesheet_wrong_pathûs þrÃÚvalr`óc    CsFddlm}d dddg¡}tj||dtj|dW5QRXdS)    Nrr¼ú|zDocument is emptyr¾zNone \(line 0\)rDr´)r¿r½rÁrFrGrIr2)rÄr½ÚmsgrrrÚtest_empty_string_stylesheets üÿ    rÈc    Cs:ddlm}d}tj|ddtj|dW5QRXdS)Nrr¼aR<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="yes" >
    <xsl:strip-space elements="*"/>
 
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
 
    <xsl:template match="row/*">
        <field>
            <xsl:attribute name="field">
                <xsl:value-of select="name()"/>
            </xsl:attribute>
            <xsl:value-of select="text()"/>
        </field>
    </xsl:template>
</xsl:stylesheet>zOpening and ending tag mismatchrDr´)r¿r½rFrGrIr2rÂrrrÚtest_incorrect_xsl_syntaxs rÉc    Cs:ddlm}d}tj|ddtj|dW5QRXdS)Nr)ÚXSLTParseErroraT<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="yes" />
    <xsl:strip-space elements="*"/>
 
    <xsl:template match="@*|node(*)">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
 
    <xsl:template match="row/*">
        <field>
            <xsl:attribute name="field">
                <xsl:value-of select="name()"/>
            </xsl:attribute>
            <xsl:value-of select="text()"/>
        </field>
    </xsl:template>
</xsl:stylesheet>zfailed to compilerDr´)r¿rÊrFrGrIr2)rÊr·rrrÚtest_incorrect_xsl_eval7s rËc
CsRddlm}d}tj|dd*t d¡}tj||dW5QRXW5QRXdS)Nr)ÚXSLTApplyErrorag<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="yes" />
    <xsl:strip-space elements="*"/>
 
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:copy-of select="document('non_existent.xml')/*"/>
        </xsl:copy>
    </xsl:template>
</xsl:stylesheet>zCannot resolve URIrDr-r´)r¿rÌrFrGr0r1rIr2)rÌr·r=rrrÚtest_incorrect_xsl_applyTs
   rÍc    Cs0d}tjtddtjd|dW5QRXdS)NaI<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="yes" />
    <xsl:strip-space elements="*"/>
 
    <xsl:template match="@*|node(*)">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>z*To use stylesheet, you need lxml installedrDr%)r&rµr¯)r·rrrÚtest_stylesheet_with_etreeis  ÿrÎcCs<d}tjdd}|dk    r | ¡}tj|d}||ks8t‚dS)NaQ<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" indent="yes" />
    <xsl:strip-space elements="*"/>
 
    <xsl:param name="delim">,</xsl:param>
    <xsl:template match="/data">
        <xsl:text>,shape,degrees,sides&#xa;</xsl:text>
        <xsl:apply-templates select="row"/>
    </xsl:template>
 
    <xsl:template match="row">
        <xsl:value-of select="concat(index, $delim, shape, $delim,
                                     degrees, $delim, sides)"/>
         <xsl:text>&#xa;</xsl:text>
    </xsl:template>
</xsl:stylesheet>Ú
)Úlineterminatorr´)rIZto_csvr6r2r8)r·Zout_csvÚout_xmlrrrÚtest_style_to_csv{s   rÒcCs*d}t ¡}tjd|d}||ks&t‚dS)Na˜<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" indent="yes" />
    <xsl:strip-space elements="*"/>
 
    <xsl:param name="delim"><xsl:text>               </xsl:text></xsl:param>
    <xsl:template match="/data">
        <xsl:text>      shape  degrees  sides&#xa;</xsl:text>
        <xsl:apply-templates select="row"/>
    </xsl:template>
 
    <xsl:template match="row">
        <xsl:value-of select="concat(index, ' ',
                                     substring($delim, 1, string-length('triangle')
                                               - string-length(shape) + 1),
                                     shape,
                                     substring($delim, 1, string-length(name(degrees))
                                               - string-length(degrees) + 2),
                                     degrees,
                                     substring($delim, 1, string-length(name(sides))
                                               - string-length(sides) + 2),
                                     sides)"/>
         <xsl:text>&#xa;</xsl:text>
    </xsl:template>
</xsl:stylesheet>ÚNaN)rbrµ)rIZ    to_stringr2r8)r·Zout_strrÑrrrÚtest_style_to_string˜srÔcCs(d}t ¡}tj|d}||ks$t‚dS)Na]<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" indent="yes" />
    <xsl:strip-space elements="*"/>
 
    <xsl:param name="quot">"</xsl:param>
 
    <xsl:template match="/data">
        <xsl:text>{"shape":{</xsl:text>
        <xsl:apply-templates select="descendant::row/shape"/>
        <xsl:text>},"degrees":{</xsl:text>
        <xsl:apply-templates select="descendant::row/degrees"/>
        <xsl:text>},"sides":{</xsl:text>
        <xsl:apply-templates select="descendant::row/sides"/>
        <xsl:text>}}</xsl:text>
    </xsl:template>
 
    <xsl:template match="shape|degrees|sides">
        <xsl:variable name="val">
            <xsl:if test = ".=''">
                <xsl:value-of select="'null'"/>
            </xsl:if>
            <xsl:if test = "number(text()) = text()">
                <xsl:value-of select="text()"/>
            </xsl:if>
            <xsl:if test = "number(text()) != text()">
                <xsl:value-of select="concat($quot, text(), $quot)"/>
            </xsl:if>
        </xsl:variable>
        <xsl:value-of select="concat($quot, preceding-sibling::index,
                                     $quot,':', $val)"/>
        <xsl:if test="preceding-sibling::index != //row[last()]/index">
            <xsl:text>,</xsl:text>
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>r´)rIÚto_jsonr2r8)r·Zout_jsonrÑrrrÚtest_style_to_jsonºs% rÖc
Csdt ¡:}tj|||dt|d|d}|j ¡}W5QRXW5QRXt|ƒ}t|     ¡ks`t
‚dS)N©r&Ú compressionr©rØ) r0r1rIr2r    Úhandler4rÚgeom_xmlr6r8)r&Úcompression_onlyr=Ú
handle_objr?rrrÚtest_compression_outputs
ýrÞc
Cstdt|}tj|d:}tj|||dt|d|d}|j ¡}W5QRXW5QRXt|ƒ}t    | 
¡kspt ‚dS)Nzxml.)r;r×rrÙ) rr0r1rIr2r    rÚr4rrÛr6r8)r&rÜZcompfiler=rÝr?rrrÚtest_filename_and_suffix_comps ýrßcCs<d}tdtgiƒ |¡}|j|d}t|ƒ ¡|ks8t‚dS)Nzd<?xml version='1.0' encoding='utf-8'?>
<data>
  <row>
    <index>0</index>
    <a/>
  </row>
</data>Úar,)rrZastyper2rr6r8)Zany_numeric_ea_dtyper&rPZdfÚresultrrrÚtest_ea_dtypes#s râc
CsBtjtdd*t ¡}tj||ddW5QRXW5QRXdS)NzUnrecognized compression typerDZ7zr×)rFrGr°r0r1rIr2rJrrrÚtest_unsuported_compression1s
rãÚs3fsc    CsLddl}tjtdd,|jdd}| d¡tjdd|d    W5QRXdS)
Nrz Access DeniedrDT)Zanonz pandas-testzs3://pandas-test/geom.xmlÚzip)rØr&)rärFrGÚPermissionErrorZ S3FileSystemZlsrIr2)r&Z s3_resourceräÚfsrrrÚtest_s3_permission_output:s
 
rè)bÚ
__future__rr(rrrÀÚnumpyÚnprFZpandas.util._test_decoratorsÚutilZ_test_decoratorsÚtdZpandasrrrZpandas._testingZ_testingr0Z pandas.tests.io.test_compressionrZpandas.io.commonr    Z pandas.io.xmlr
ÚnanrIrƒr7rZfixturer#r Z
skip_if_nor&r@rArCrKrQrRÚmarkZ parametrizerˆÚranger[r]r_rcrfrirlrqrurxrzr{r|r‡r‹rrr’r”r•r—ržrŸr¢r£r¥r§r«r¬Zskip_if_installedr®r±r¶r¸rºr»rÃrÈrÉrËrÍrÎrÒrÔrÖrÛrÞrßrârãZ
single_cpurèrrrrÚ<module>s     $
ýÿø ø ø øáÿ- 
 
 
 (* ÿ
&! /'! +$
 
 
    
 
 
 
 
 
 
 
 
!
/