Skip to content

Commit

Permalink
MAINT: use f-string format in test_abc.py (#21763)
Browse files Browse the repository at this point in the history
* Changed f-string format

Changed f-string format for the clear and clean understanding of code.

* Update test_abc.py
  • Loading branch information
cyai committed Jun 15, 2022
1 parent 118e6c4 commit d2a9862
Showing 1 changed file with 12 additions and 12 deletions.
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")

0 comments on commit d2a9862

Please sign in to comment.