Skip to content

Commit bdcbca1

Browse files
Apply formatting and import sorting from pre-commit hooks
1 parent c3aa8f0 commit bdcbca1

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

pandas/io/formats/printing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def pprint_thing(
199199
-------
200200
str
201201
"""
202+
202203
def as_escaped_string(
203204
thing: Any, escape_chars: EscapeChars | None = escape_chars
204205
) -> str:

pandas/tests/io/formats/test_printing.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,31 @@
22
# functions, not the general printing of pandas objects.
33
from collections.abc import Mapping
44
import string
5+
56
import pytest
7+
68
import pandas._config.config as cf
9+
710
import pandas as pd
11+
812
from pandas.io.formats import printing
913

1014

11-
@pytest.mark.parametrize("input_names, expected_names", [
12-
(["'a", "b"], ["\'a", "b"]), # Escape leading quote
13-
(["test's", "b"], ["test\'s", "b"]), # Escape apostrophe
14-
(["'test'", "b"], ["\'test\'", "b"]), # Escape surrounding quotes
15-
(["test","b'"], ["test","b\'"]), # Escape single quote
16-
(["'test\n'", "b"], ["\'test\n\'", "b"]) # Escape and preserve newline
17-
])
15+
@pytest.mark.parametrize(
16+
"input_names, expected_names",
17+
[
18+
(["'a", "b"], ["'a", "b"]), # Escape leading quote
19+
(["test's", "b"], ["test's", "b"]), # Escape apostrophe
20+
(["'test'", "b"], ["'test'", "b"]), # Escape surrounding quotes
21+
(["test", "b'"], ["test", "b'"]), # Escape single quote
22+
(["'test\n'", "b"], ["'test\n'", "b"]), # Escape and preserve newline
23+
],
24+
)
1825
def test_formatted_index_names(input_names, expected_names):
19-
# Create DataFrame with specified index names
20-
df = pd.DataFrame(
21-
{name: [1, 2, 3] for name in input_names}
22-
).set_index(input_names)
26+
# GH#60190
27+
df = pd.DataFrame({name: [1, 2, 3] for name in input_names}).set_index(input_names)
2328
formatted_names = df.index.names
24-
29+
2530
assert formatted_names == expected_names
2631

2732

0 commit comments

Comments
 (0)