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
U
­ý°d€ã    @sädZddlmZddlZddlZddlmZddlm    Z
ej   d¡Z ej  dddgg¡dd    „ƒZej  d
id d id dig¡dd„ƒZdd„Zdd„Zdd„Zej  dddddd dg¡dd„ƒZej  dd dg¡d!d"„ƒZd#d$„ZdS)%zf
Tests that comments are properly handled during parsing
for all of the parsers defined in parsers.py
é)ÚStringION)Ú    DataFrameZ pyarrow_skipÚ    na_valuesÚNaNcCsP|}d}tdddgdtjdggddd    gd
}|jt|ƒd |d }t ||¡dS) Nz&A,B,C
1,2.,4.#hello world
5.,NaN,10.0
çð?ç@ç@ç@ç$@ÚAÚBÚC©Úcolumnsú#©Úcommentr©rÚnpÚnanÚread_csvrÚtmÚassert_frame_equal)Ú all_parsersrÚparserÚdataÚexpectedÚresult©rúZd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/io/parser/test_comment.pyÚ test_commentsÿr Ú read_kwargsÚlineterminatorÚ*Údelim_whitespaceTcCs®|}d}| d¡r | dd¡}n@| d¡r`|jdkrNtjjdd}|j |¡| d    | d¡¡}d
|d <|jt    |ƒf|Ž}t
d d dgdt j dggdddgd}t  ||¡dS)Nz@# empty
A,B,C
1,2.,4.#hello world
#ignore this line
5.,NaN,10.0
r$ú,ú r"Úcz2Custom terminator not supported with Python engine)ÚreasonÚ
rrrrrr    r
r r r r)ÚgetÚreplaceÚengineÚpytestÚmarkÚxfailÚnodeÚ
add_markerrrrrrrr)rr!Úrequestrrr.rrrrrÚtest_line_comments$
 
 
ÿ ÿr3cCsP|}d}tdddgdtjdggddd    gd
}|jt|ƒd d d }t ||¡dS)NzH# empty
random line
# second empty line
1,2,3
A,B,C
1,2.,4.
5.,NaN,10.0
rrrr    r
r r r rré)rÚskiprowsr©rrrrrrrrÚtest_comment_skiprows=s    ÿr7cCsP|}d}tdddgdtjdggddd    gd
}|jt|ƒd d d }t ||¡dS)Nz<# empty
# second empty line
1,2,3
A,B,C
1,2.,4.
5.,NaN,10.0
rrrr    r
r r r rré©rÚheaderrr6rrrÚtest_comment_headerOsÿr;cCsR|}d}tdddgdtjdggddd    gd
}|jt|ƒd d d d}t ||¡dS)NzU# empty
# second empty line
# third empty line
X,Y,Z
1,2,3
A,B,C
1,2.,4.
5.,NaN,10.0
rrrr    r
r r r rrr4r8)rr5r:rr6rrrÚtest_comment_skiprows_header`s ÿr<Ú comment_charrú~ú&ú^ú@cCsT|}d}|jt| d|¡ƒ|d}tdddgddd    ggd
d d gd }t ||¡dS)Nz,a,b,c
1,2,3#ignore this!
4,5,6#ignorethistoor)rr8éér4ééÚaÚbr'r)rrr+rrr)rr=rrrrrrrÚtest_custom_comment_charusÿ"rHr:ZinfercCsl|}d}|dkr.tddgddgddgdœƒ}ntd    d
d ggdddgd }|jt|ƒd |d}t ||¡dS)Nz # notes
a,b,c
# more notes
1,2,3rFÚ1rGÚ2r'Ú3)rr8rBr8rBrCrrr9)rrrrr)rr:rrrrrrrÚtest_comment_first_linesrLcCs‚|jdkr&d}|j tjj|td¡|}d}|jt|ƒddd}t    dd    d
gd d d gdt
j t
j gdt
j dgdœƒ}t   ||¡dS)Nr'z=see gh-34002: works on the python engine but not the c engine)r(ZraiseszU# this is a comment
col1,col2,col3,col4
1,2,3,4#inline comment
4,5#,6,10
7,8,#N/A,11
rz#N/Arr8r4érBrDég@rg&@)Zcol1Zcol2Zcol3Zcol4)r,r0r1r-r.r/ÚAssertionErrorrrrrrrr)rr2r(rrrrrrrÚ"test_comment_char_in_default_values
ÿ 
üÿrP)Ú__doc__ÚiorÚnumpyrr-ZpandasrZpandas._testingZ_testingrr.Z usefixturesZ
pytestmarkZ parametrizer r3r7r;r<rHrLrPrrrrÚ<module>s*    
ÿ