small mypy fixes
This commit is contained in:
parent
450d264623
commit
ccd87f9e80
|
@ -81,19 +81,12 @@ def _format_lines(lines):
|
|||
return result
|
||||
|
||||
|
||||
# Provide basestring in python3
|
||||
try:
|
||||
basestring = basestring
|
||||
except NameError:
|
||||
basestring = str
|
||||
|
||||
|
||||
def issequence(x):
|
||||
return isinstance(x, Sequence) and not isinstance(x, basestring)
|
||||
return isinstance(x, Sequence) and not isinstance(x, str)
|
||||
|
||||
|
||||
def istext(x):
|
||||
return isinstance(x, basestring)
|
||||
return isinstance(x, str)
|
||||
|
||||
|
||||
def isdict(x):
|
||||
|
|
|
@ -114,7 +114,7 @@ def fail(msg="", pytrace=True):
|
|||
fail.Exception = Failed
|
||||
|
||||
|
||||
class XFailed(fail.Exception):
|
||||
class XFailed(Failed):
|
||||
""" raised from an explicit call to pytest.xfail() """
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ def test_maxsize():
|
|||
|
||||
def test_maxsize_error_on_instance():
|
||||
class A:
|
||||
def __repr__():
|
||||
def __repr__(self):
|
||||
raise ValueError("...")
|
||||
|
||||
s = saferepr(("*" * 50, A()), maxsize=25)
|
||||
|
|
|
@ -26,10 +26,10 @@ def test_getfuncargnames():
|
|||
|
||||
assert fixtures.getfuncargnames(h) == ("arg1",)
|
||||
|
||||
def h(arg1, arg2, arg3="hello"):
|
||||
def j(arg1, arg2, arg3="hello"):
|
||||
pass
|
||||
|
||||
assert fixtures.getfuncargnames(h) == ("arg1", "arg2")
|
||||
assert fixtures.getfuncargnames(j) == ("arg1", "arg2")
|
||||
|
||||
class A:
|
||||
def f(self, arg1, arg2="hello"):
|
||||
|
|
|
@ -235,7 +235,7 @@ class TestRaises:
|
|||
int("asdf")
|
||||
|
||||
def test_raises_exception_looks_iterable(self):
|
||||
class Meta(type(object)):
|
||||
class Meta(type):
|
||||
def __getitem__(self, item):
|
||||
return 1 / 0
|
||||
|
||||
|
|
|
@ -189,12 +189,7 @@ def test_hookrecorder_basic(holder):
|
|||
|
||||
|
||||
def test_makepyfile_unicode(testdir):
|
||||
global unichr
|
||||
try:
|
||||
unichr(65)
|
||||
except NameError:
|
||||
unichr = chr
|
||||
testdir.makepyfile(unichr(0xFFFD))
|
||||
testdir.makepyfile(chr(0xFFFD))
|
||||
|
||||
|
||||
def test_makepyfile_utf8(testdir):
|
||||
|
|
|
@ -24,7 +24,6 @@ def test_ensuretemp(recwarn):
|
|||
@attr.s
|
||||
class FakeConfig:
|
||||
basetemp = attr.ib()
|
||||
trace = attr.ib(default=None)
|
||||
|
||||
@property
|
||||
def trace(self):
|
||||
|
|
Loading…
Reference in New Issue