diff --git a/pandas/tests/io/parser/test_quoting.py b/pandas/tests/io/parser/test_quoting.py index 14773dfbea20e..7a07632390eff 100644 --- a/pandas/tests/io/parser/test_quoting.py +++ b/pandas/tests/io/parser/test_quoting.py @@ -17,12 +17,12 @@ @pytest.mark.parametrize( "kwargs,msg", [ - (dict(quotechar="foo"), '"quotechar" must be a(n)? 1-character string'), + ({"quotechar": "foo"}, '"quotechar" must be a(n)? 1-character string'), ( - dict(quotechar=None, quoting=csv.QUOTE_MINIMAL), + {"quotechar": None, "quoting": csv.QUOTE_MINIMAL}, "quotechar must be set if quoting enabled", ), - (dict(quotechar=2), '"quotechar" must be string, not int'), + ({"quotechar": 2}, '"quotechar" must be string, not int'), ], ) def test_bad_quote_char(all_parsers, kwargs, msg): @@ -72,7 +72,7 @@ def test_quote_char_various(all_parsers, quote_char): @pytest.mark.parametrize("quoting", [csv.QUOTE_MINIMAL, csv.QUOTE_NONE]) @pytest.mark.parametrize("quote_char", ["", None]) def test_null_quote_char(all_parsers, quoting, quote_char): - kwargs = dict(quotechar=quote_char, quoting=quoting) + kwargs = {"quotechar": quote_char, "quoting": quoting} data = "a,b,c\n1,2,3" parser = all_parsers @@ -91,17 +91,17 @@ def test_null_quote_char(all_parsers, quoting, quote_char): @pytest.mark.parametrize( "kwargs,exp_data", [ - (dict(), [[1, 2, "foo"]]), # Test default. + ({}, [[1, 2, "foo"]]), # Test default. # QUOTE_MINIMAL only applies to CSV writing, so no effect on reading. - (dict(quotechar='"', quoting=csv.QUOTE_MINIMAL), [[1, 2, "foo"]]), + ({"quotechar": '"', "quoting": csv.QUOTE_MINIMAL}, [[1, 2, "foo"]]), # QUOTE_MINIMAL only applies to CSV writing, so no effect on reading. - (dict(quotechar='"', quoting=csv.QUOTE_ALL), [[1, 2, "foo"]]), + ({"quotechar": '"', "quoting": csv.QUOTE_ALL}, [[1, 2, "foo"]]), # QUOTE_NONE tells the reader to do no special handling # of quote characters and leave them alone. - (dict(quotechar='"', quoting=csv.QUOTE_NONE), [[1, 2, '"foo"']]), + ({"quotechar": '"', "quoting": csv.QUOTE_NONE}, [[1, 2, '"foo"']]), # QUOTE_NONNUMERIC tells the reader to cast # all non-quoted fields to float - (dict(quotechar='"', quoting=csv.QUOTE_NONNUMERIC), [[1.0, 2.0, "foo"]]), + ({"quotechar": '"', "quoting": csv.QUOTE_NONNUMERIC}, [[1.0, 2.0, "foo"]]), ], ) def test_quoting_various(all_parsers, kwargs, exp_data): diff --git a/pandas/tests/io/parser/test_usecols.py b/pandas/tests/io/parser/test_usecols.py index 7e9c9866a666d..fbf3b0ea7c792 100644 --- a/pandas/tests/io/parser/test_usecols.py +++ b/pandas/tests/io/parser/test_usecols.py @@ -477,14 +477,14 @@ def test_incomplete_first_row(all_parsers, usecols): ( "19,29,39\n" * 2 + "10,20,30,40", [0, 1, 2], - dict(header=None), + {"header": None}, DataFrame([[19, 29, 39], [19, 29, 39], [10, 20, 30]]), ), # see gh-9549 ( ("A,B,C\n1,2,3\n3,4,5\n1,2,4,5,1,6\n1,2,3,,,1,\n1,2,3\n5,6,7"), ["A", "B", "C"], - dict(), + {}, DataFrame( { "A": [1, 3, 1, 1, 1, 5], @@ -507,39 +507,39 @@ def test_uneven_length_cols(all_parsers, data, usecols, kwargs, expected): [ ( ["a", "b", "c", "d"], - dict(), + {}, DataFrame({"a": [1, 5], "b": [2, 6], "c": [3, 7], "d": [4, 8]}), None, ), ( ["a", "b", "c", "f"], - dict(), + {}, None, _msg_validate_usecols_names.format(r"\['f'\]"), ), - (["a", "b", "f"], dict(), None, _msg_validate_usecols_names.format(r"\['f'\]")), + (["a", "b", "f"], {}, None, _msg_validate_usecols_names.format(r"\['f'\]")), ( ["a", "b", "f", "g"], - dict(), + {}, None, _msg_validate_usecols_names.format(r"\[('f', 'g'|'g', 'f')\]"), ), # see gh-14671 ( None, - dict(header=0, names=["A", "B", "C", "D"]), + {"header": 0, "names": ["A", "B", "C", "D"]}, DataFrame({"A": [1, 5], "B": [2, 6], "C": [3, 7], "D": [4, 8]}), None, ), ( ["A", "B", "C", "f"], - dict(header=0, names=["A", "B", "C", "D"]), + {"header": 0, "names": ["A", "B", "C", "D"]}, None, _msg_validate_usecols_names.format(r"\['f'\]"), ), ( ["A", "B", "f"], - dict(names=["A", "B", "C", "D"]), + {"names": ["A", "B", "C", "D"]}, None, _msg_validate_usecols_names.format(r"\['f'\]"), ),