8000 CLN: fixed a few style issues reported by ruff 0.5 · larray-project/larray@bb99334 · GitHub
[go: up one dir, main page]

Skip to content

Commit bb99334

Browse files
committed
CLN: fixed a few style issues reported by ruff 0.5
and silence false positives
1 parent 32171cf commit bb99334

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

larray/core/axis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def __init__(self, labels, name=None):
111111

112112
# make sure we do not have np.str_ as it causes problems down the
113113
# line with xlwings. Cannot use isinstance to check that though.
114-
name_is_python_str = type(name) is str or type(name) is bytes
114+
name_is_python_str = type(name) is str or type(name) is bytes # noqa: E721
115115
if isinstance(name, str) and not name_is_python_str:
116116
name = str(name)
117117
if name is not None and not isinstance(name, (int, str)):

larray/tests/test_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def test_ndtest():
217217

218218

219219
def test_getattr(array):
220-
assert type(array.b) == Axis
220+
assert isinstance(array.b, Axis)
221221
assert array.b is b
222222
with must_raise(AttributeError, msg="'Array' object has no attribute 'bm'"):
223223
_ = array.bm

larray/tests/test_excel.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,9 @@ def test_get_and_set_item(self):
192192
obj_arr_dump = obj_arr.dump()
193193
# [['a\\b', 'b0', 'b1', 'b2'], ['a0', 0, nan, 2], ['a1', 3, 4, 5]]
194194

195-
# float and *not* np.float64, otherwise it gets converted to 65535 when written to Excel
196-
assert type(obj_arr_dump[1][2]) is float
195+
# float and *not* np.float64 (which inherits from float), otherwise it gets
196+
# converted to 65535 when written to Excel
197+
assert type(obj_arr_dump[1][2]) is float # noqa: E721
197198

198199
sheet['A12'] = obj_arr_dump
199200

larray/tests/test_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ def test_add(session):
155155
with must_warn((UserWarning, FutureWarning), match='.*', num_expected=None) as caught_warnings:
156156
session.add(i, i01, j='j')
157157

158-
future_warnings = [w for w in caught_warnings if w.category == FutureWarning]
158+
future_warnings = [w for w in caught_warnings if w.category is FutureWarning]
159159
assert len(future_warnings) == 1
160160
# .message is the w object itself, .message.args[0] is the actual message
161161
assert future_warnings[0].message.args[0] == "Session.add() is deprecated. Please use Session.update() instead."
162162

163163
if isinstance(session, CheckedSession):
164-
user_warnings = [w for w in caught_warnings if w.category == UserWarning]
164+
user_warnings = [w for w in caught_warnings if w.category is UserWarning]
165165
assert len(user_warnings) == 3
166166
assert all(re.match(r"'\w+' is not declared in 'CheckedSessionExample'", w.message.args[0])
167167
for w in user_warnings)

0 commit comments

Comments
 (0)
0