File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,13 @@ def _validate_header_arg(header) -> None:
125
125
"the row(s) making up the column names"
126
126
)
127
127
128
+ if header == - 1 : # In versions prior to 0.25, this
129
+ # would have worked.
130
+ raise ValueError (
131
+ "Passing -1 to header is invalid. "
132
+ "For no header, use header=None instead"
133
+ )
134
+
128
135
129
136
def _stringify_path (
130
137
filepath_or_buffer : FilePathOrBuffer [AnyStr ]
Original file line number Diff line number Diff line change @@ -39,6 +39,20 @@ def test_bool_header_arg(all_parsers, header):
39
39
parser .read_csv (StringIO (data ), header = header )
40
40
41
41
42
+ def test_negative_header (all_parsers ):
43
+ parser = all_parsers
44
+ data = """1,2,3,4,5
45
+ 6,7,8,9,10
46
+ 11,12,13,14,15
47
+ """
48
+ with pytest .raises (
49
+ ValueError ,
50
+ match = "Passing -1 to header is invalid. "
51
+ "For no header, use header=None instead" ,
52
+ ):
53
+ parser .read_csv (StringIO (data ), header = - 1 )
54
+
55
+
42
56
def test_no_header_prefix (all_parsers ):
43
57
parser = all_parsers
44
58
data = """1,2,3,4,5
You can’t perform that action at this time.
0 commit comments