More flake8-ification
diff --git a/OpenSSL/test/util.py b/OpenSSL/test/util.py
index 073aa6c..8b034dc 100644
--- a/OpenSSL/test/util.py
+++ b/OpenSSL/test/util.py
@@ -25,12 +25,10 @@
from OpenSSL._util import ffi, lib, byte_string as b
-
# This is the UTF-8 encoding of the SNOWMAN unicode code point.
NON_ASCII = b("\xe2\x98\x83").decode("utf-8")
-
class TestCase(TestCase):
"""
:py:class:`TestCase` adds useful testing functionality beyond what is
@@ -69,7 +67,6 @@
self._reportLeaks(after - before, result)
-
def _reportLeaks(self, leaks, result):
def format_leak(p):
stacks = memdbg.heap[p]
@@ -110,11 +107,13 @@
# ...
#
# Notice the stack is upside down compared to a Python traceback.
- # Identify the start and end of interesting bits and stuff it into the stack we report.
+ # Identify the start and end of interesting bits and stuff it into
+ # the stack we report.
saved = list(c_stack)
- # Figure the first interesting frame will be after a the cffi-compiled module
+ # Figure the first interesting frame will be after a the
+ # cffi-compiled module
while c_stack and '/__pycache__/_cffi__' not in c_stack[-1]:
c_stack.pop()
@@ -155,10 +154,8 @@
self,
(None, Exception(stack % (allocs_report,)), None))
-
_tmpdir = None
-
@property
def tmpdir(self):
"""
@@ -170,7 +167,6 @@
self._tmpdir = mkdtemp(dir=".")
return self._tmpdir
-
def tearDown(self):
"""
Clean up any files or directories created using
@@ -189,7 +185,6 @@
"Left over errors in OpenSSL error queue: " + repr(e)
)
-
def assertIsInstance(self, instance, classOrTuple, message=None):
"""
Fail if C{instance} is not an instance of the given class or of
@@ -211,8 +206,7 @@
else:
suffix = ": " + message
self.fail("%r is not an instance of %s%s" % (
- instance, classOrTuple, suffix))
-
+ instance, classOrTuple, suffix))
def failUnlessIn(self, containee, container, msg=None):
"""
@@ -246,7 +240,6 @@
return containee
failIfIn = assertNotIn
-
def assertIs(self, first, second, msg=None):
"""
Fail the test if :py:data:`first` is not :py:data:`second`. This is an
@@ -261,7 +254,6 @@
return first
assertIdentical = failUnlessIdentical = assertIs
-
def assertIsNot(self, first, second, msg=None):
"""
Fail the test if :py:data:`first` is :py:data:`second`. This is an
@@ -276,7 +268,6 @@
return first
assertNotIdentical = failIfIdentical = assertIsNot
-
def failUnlessRaises(self, exception, f, *args, **kwargs):
"""
Fail the test unless calling the function :py:data:`f` with the given
@@ -301,13 +292,12 @@
raise self.failureException('%s raised instead of %s'
% (sys.exc_info()[0],
exception.__name__,
- ))
+ ))
else:
raise self.failureException('%s not raised (%r returned)'
% (exception.__name__, result))
assertRaises = failUnlessRaises
-
def mktemp(self):
"""
Return UTF-8-encoded bytes of a path to a tmp file.
@@ -316,7 +306,6 @@
"""
return mktemp(dir=self.tmpdir).encode("utf-8")
-
# Other stuff
def assertConsistentType(self, theType, name, *constructionArgs):
"""
@@ -336,7 +325,6 @@
self.assertIdentical(type(instance), theType)
-
class EqualityTestsMixin(object):
"""
A mixin defining tests for the standard implementation of C{==} and C{!=}.
@@ -349,7 +337,6 @@
"""
raise NotImplementedError()
-
def anotherInstance(self):
"""
Return an instance of the class under test. Each call to this method
@@ -359,7 +346,6 @@
"""
raise NotImplementedError()
-
def test_identicalEq(self):
"""
An object compares equal to itself using the C{==} operator.
@@ -367,7 +353,6 @@
o = self.anInstance()
self.assertTrue(o == o)
-
def test_identicalNe(self):
"""
An object doesn't compare not equal to itself using the C{!=} operator.
@@ -375,7 +360,6 @@
o = self.anInstance()
self.assertFalse(o != o)
-
def test_sameEq(self):
"""
Two objects that are equal to each other compare equal to each other
@@ -385,7 +369,6 @@
b = self.anInstance()
self.assertTrue(a == b)
-
def test_sameNe(self):
"""
Two objects that are equal to each other do not compare not equal to
@@ -395,7 +378,6 @@
b = self.anInstance()
self.assertFalse(a != b)
-
def test_differentEq(self):
"""
Two objects that are not equal to each other do not compare equal to
@@ -405,7 +387,6 @@
b = self.anotherInstance()
self.assertFalse(a == b)
-
def test_differentNe(self):
"""
Two objects that are not equal to each other compare not equal to each
@@ -415,7 +396,6 @@
b = self.anotherInstance()
self.assertTrue(a != b)
-
def test_anotherTypeEq(self):
"""
The object does not compare equal to an object of an unrelated type
@@ -425,7 +405,6 @@
b = object()
self.assertFalse(a == b)
-
def test_anotherTypeNe(self):
"""
The object compares not equal to an object of an unrelated type (which
@@ -435,7 +414,6 @@
b = object()
self.assertTrue(a != b)
-
def test_delegatedEq(self):
"""
The result of comparison using C{==} is delegated to the right-hand
@@ -450,7 +428,6 @@
b = Delegate()
self.assertEqual(a == b, [b])
-
def test_delegateNe(self):
"""
The result of comparison using C{!=} is delegated to the right-hand