Skip to content

Commit 85c0efb

Browse files
committed
minor lint
1 parent 10311c3 commit 85c0efb

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

pandas/tests/indexes/categorical/test_formats.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ class TestCategoricalIndexRepr:
1515
def test_string_categorical_index_repr(self):
1616
# short
1717
idx = CategoricalIndex(["a", "bb", "ccc"])
18-
expected = """CategoricalIndex(['a', 'bb', 'ccc'], categories=['a', 'bb', 'ccc'], ordered=False, dtype='category')""" # noqa: E501
18+
expected = """CategoricalIndex(['a', 'bb', 'ccc'],
19+
categories=['a', 'bb', 'ccc'], ordered=False, dtype='category')"""
1920
assert repr(idx) == expected
2021

2122
# multiple lines
2223
idx = CategoricalIndex(["a", "bb", "ccc"] * 10)
2324
expected = """CategoricalIndex(['a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a',
2425
'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb',
2526
'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc'],
26-
categories=['a', 'bb', 'ccc'], ordered=False, dtype='category')""" # noqa: E501
27+
categories=['a', 'bb', 'ccc'],
28+
ordered=False, dtype='category')"""
2729

2830
assert repr(idx) == expected
2931

@@ -32,27 +34,30 @@ def test_string_categorical_index_repr(self):
3234
expected = """CategoricalIndex(['a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a',
3335
...
3436
'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc', 'a', 'bb', 'ccc'],
35-
categories=['a', 'bb', 'ccc'], ordered=False, dtype='category', length=300)""" # noqa: E501
37+
categories=['a', 'bb', 'ccc'],
38+
ordered=False, dtype='category', length=300)"""
3639

3740
assert repr(idx) == expected
3841

3942
# larger categories
4043
idx = CategoricalIndex(list("abcdefghijklmmo"))
4144
expected = """CategoricalIndex(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
4245
'm', 'm', 'o'],
43-
categories=['a', 'b', 'c', 'd', ..., 'k', 'l', 'm', 'o'], ordered=False, dtype='category')""" # noqa: E501
46+
categories=['a', 'b', 'c', 'd', ..., 'k', 'l', 'm', 'o'],
47+
ordered=False, dtype='category')"""
4448

4549
assert repr(idx) == expected
4650

4751
# short
4852
idx = CategoricalIndex(["あ", "いい", "ううう"])
49-
expected = """CategoricalIndex(['あ', 'いい', 'ううう'], categories=['あ', 'いい', 'ううう'], ordered=False, dtype='category')""" # noqa: E501
53+
expected = """CategoricalIndex(['あ', 'いい', 'ううう'], categories=['あ', 'いい', 'ううう'],
54+
ordered=False, dtype='category')"""
5055
assert repr(idx) == expected
5156

5257
# multiple lines
5358
idx = CategoricalIndex(["あ", "いい", "ううう"] * 10)
5459
expected = """CategoricalIndex(['あ', 'いい', 'ううう', 'あ', 'いい',
55-
'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ',
60+
'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ',
5661
'いい','ううう', 'あ', 'いい', 'ううう', 'あ', 'いい',
5762
'ううう', 'あ', 'いい', 'ううう', 'あ',
5863
'いい', 'ううう', 'あ', 'いい', 'ううう'],
@@ -63,7 +68,7 @@ def test_string_categorical_index_repr(self):
6368

6469
# truncated
6570
idx = CategoricalIndex(["あ", "いい", "ううう"] * 100)
66-
expected = """CategoricalIndex(['あ', 'いい', 'ううう', 'あ', 'いい',
71+
expected = """CategoricalIndex(['あ', 'いい', 'ううう', 'あ', 'いい',
6772
'ううう', 'あ', 'いい', 'ううう', 'あ',
6873
...
6974
'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ',
@@ -74,7 +79,7 @@ def test_string_categorical_index_repr(self):
7479

7580
# larger categories
7681
idx = CategoricalIndex(list("あいうえおかきくけこさしすせそ"))
77-
expected = """CategoricalIndex(['あ', 'い', 'う', 'え', 'お', 'か', 'き',
82+
expected = """CategoricalIndex(['あ', 'い', 'う', 'え', 'お', 'か', 'き',
7883
'く', 'け', 'こ', 'さ', 'し','す', 'せ', 'そ'],
7984
categories=['あ', 'い', 'う', 'え', ..., 'し', 'す', 'せ', 'そ']
8085
, ordered=False, dtype='category')"""
@@ -85,8 +90,8 @@ def test_string_categorical_index_repr(self):
8590
with cf.option_context("display.unicode.east_asian_width", True):
8691
# short
8792
idx = CategoricalIndex(["あ", "いい", "ううう"])
88-
expected = """CategoricalIndex(['あ', 'いい', 'ううう'],
89-
categories=['あ', 'いい', 'ううう'], ordered=False, dtype='category')"""
93+
expected = """CategoricalIndex(['あ', 'いい', 'ううう'],
94+
categories=['あ', 'いい', 'ううう'], ordered=False, dtype='category')"""
9095
assert repr(idx) == expected
9196

9297
# multiple lines
@@ -95,8 +100,8 @@ def test_string_categorical_index_repr(self):
95100
'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう',
96101
'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい',
97102
'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう'],
98-
categories=['あ', 'いい', 'ううう'],
99-
ordered=False, dtype='category')"""
103+
categories=['あ', 'いい', 'ううう'],
104+
ordered=False, dtype='category')"""""
100105

101106
assert repr(idx) == expected
102107

@@ -108,15 +113,14 @@ def test_string_categorical_index_repr(self):
108113
'ううう', 'あ', 'いい', 'ううう', 'あ', 'いい', 'ううう'
109114
,'あ', 'いい', 'ううう'],
110115
categories=['あ', 'いい', 'ううう'], ordered=False, dtype='category', length=300)"""
111-
112116
assert repr(idx) == expected
113117

114118
# larger categories
115119
idx = CategoricalIndex(list("あいうえおかきくけこさしすせそ"))
116120
expected = """CategoricalIndex(['あ', 'い', 'う', 'え',
117121
'お', 'か', 'き', 'く', 'け', 'こ',
118122
'さ', 'し', 'す', 'せ', 'そ'],
119-
categories=['あ', 'い', 'う', 'え', ..., 'し', 'す', 'せ', 'そ'],
120-
ordered=False, dtype='category')"""
123+
categories=['あ', 'い', 'う', 'え', ..., 'し', 'す', 'せ', 'そ'],
124+
ordered=False, dtype='category')"""""
121125

122126
assert repr(idx) == expected

pandas/tests/indexes/test_base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,13 +1747,13 @@ def test_index_from_dict_keys_with_dtype():
17471747
d = {"a": 1, "b": 2}
17481748

17491749
# Test without dtype (default inference)
1750-
idx_no_dtype = pd.Index(d.keys())
1751-
expected_no_dtype = pd.Index(["a", "b"], dtype="object")
1750+
idx_no_dtype = Index(d.keys())
1751+
expected_no_dtype = Index(["a", "b"], dtype="object")
17521752
tm.assert_index_equal(idx_no_dtype, expected_no_dtype)
17531753

17541754
# Test with dtype="str"
1755-
idx_with_dtype = pd.Index(d.keys(), dtype="str")
1756-
expected_with_dtype = pd.Index(["a", "b"], dtype="string[python]")
1755+
idx_with_dtype = Index(d.keys(), dtype="str")
1756+
expected_with_dtype = Index(["a", "b"], dtype="string[python]")
17571757
tm.assert_index_equal(idx_with_dtype, expected_with_dtype)
17581758

17591759
# Ensure dtype inference still works

0 commit comments

Comments
 (0)