Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: use f-string format in test_abc.py #21763

Merged
merged 2 commits into from Jun 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 12 additions & 12 deletions numpy/core/tests/test_abc.py
Expand Up @@ -20,35 +20,35 @@ def test_abstract(self):
def test_floats(self):
for t in sctypes['float']:
assert_(isinstance(t(), numbers.Real),
"{0} is not instance of Real".format(t.__name__))
f"{t.__name__} is not instance of Real")
assert_(issubclass(t, numbers.Real),
"{0} is not subclass of Real".format(t.__name__))
f"{t.__name__} is not subclass of Real")
assert_(not isinstance(t(), numbers.Rational),
"{0} is instance of Rational".format(t.__name__))
f"{t.__name__} is instance of Rational")
assert_(not issubclass(t, numbers.Rational),
"{0} is subclass of Rational".format(t.__name__))
f"{t.__name__} is subclass of Rational")

def test_complex(self):
for t in sctypes['complex']:
assert_(isinstance(t(), numbers.Complex),
"{0} is not instance of Complex".format(t.__name__))
f"{t.__name__} is not instance of Complex")
assert_(issubclass(t, numbers.Complex),
"{0} is not subclass of Complex".format(t.__name__))
f"{t.__name__} is not subclass of Complex")
assert_(not isinstance(t(), numbers.Real),
"{0} is instance of Real".format(t.__name__))
f"{t.__name__} is instance of Real")
assert_(not issubclass(t, numbers.Real),
"{0} is subclass of Real".format(t.__name__))
f"{t.__name__} is subclass of Real")

def test_int(self):
for t in sctypes['int']:
assert_(isinstance(t(), numbers.Integral),
"{0} is not instance of Integral".format(t.__name__))
f"{t.__name__} is not instance of Integral")
assert_(issubclass(t, numbers.Integral),
"{0} is not subclass of Integral".format(t.__name__))
f"{t.__name__} is not subclass of Integral")

def test_uint(self):
for t in sctypes['uint']:
assert_(isinstance(t(), numbers.Integral),
"{0} is not instance of Integral".format(t.__name__))
f"{t.__name__} is not instance of Integral")
assert_(issubclass(t, numbers.Integral),
"{0} is not subclass of Integral".format(t.__name__))
f"{t.__name__} is not subclass of Integral")