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