Skip to content

Commit

Permalink
More fixes for ruff warnings about type checking
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <mattia.verga@tiscali.it>
  • Loading branch information
mattiaverga committed Aug 26, 2023
1 parent c050b31 commit 0f8edb3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bodhi-server/bodhi/server/tasks/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1430,11 +1430,11 @@ def _raise_on_get_build_multicall_error(self, result, build):
build (bodhi.server.models.Build): build for which the koji.multiCall() returned
this result.
"""
if type(result) is list and not result:
if isinstance(result, list) and not result:
err = 'Empty list returned for getBuild("%s").' % build.nvr
log.error(err)
raise Exception(err)
elif type(result) is not list:
elif not isinstance(result, list):
err = 'Unexpected data returned for getBuild("%s"): %r.' \
% (build.nvr, result)
log.error(err)
Expand Down
2 changes: 1 addition & 1 deletion bodhi-server/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_koji_settings_are_strs(self):
c._validate()

for k in ('koji_hub', 'krb_ccache', 'krb_keytab', 'krb_principal'):
assert type(c[k]) is str
assert isinstance(c[k], str)
# And the values should match what we did above.
assert c['koji_hub'] == 'http://example.com/kojihub'
assert c['krb_ccache'] == '/tmp/krb5cc_%{uid}'
Expand Down
6 changes: 3 additions & 3 deletions bodhi-server/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ModelTest(BasePyTestCase):
def setup_method(self):
super(ModelTest, self).setup_method(self)
buildsys.setup_buildsystem({'buildsystem': 'dev'})
if type(self) is not ModelTest:
if type(self) is not ModelTest: # noqa: E721
try:
new_attrs = {}
new_attrs.update(self.attrs)
Expand Down Expand Up @@ -439,7 +439,7 @@ def test___iter__(self):

for v in iter(m):
assert repr(v) == '<{}>'.format(expected_values.pop(0))
assert type(v) is model.EnumSymbol
assert type(v) is model.EnumSymbol # noqa: E721

assert expected_values == []

Expand Down Expand Up @@ -497,7 +497,7 @@ def test___str__(self):
s = model.EnumSymbol(model.UpdateStatus, 'name', 'value', 'description')

assert str(s) == 'value'
assert type(str(s)) == str
assert isinstance(str(s), str)


class TestCompose(BasePyTestCase):
Expand Down

0 comments on commit 0f8edb3

Please sign in to comment.