diff --git a/html5lib/_inputstream.py b/html5lib/_inputstream.py
index 0207dd21..a93b5a4e 100644
--- a/html5lib/_inputstream.py
+++ b/html5lib/_inputstream.py
@@ -324,7 +324,7 @@ def charsUntil(self, characters, opposite=False):
except KeyError:
if __debug__:
for c in characters:
- assert(ord(c) < 128)
+ assert ord(c) < 128
regex = "".join(["\\x%02x" % ord(c) for c in characters])
if not opposite:
regex = "^%s" % regex
diff --git a/html5lib/serializer.py b/html5lib/serializer.py
index c66df683..a171ac1c 100644
--- a/html5lib/serializer.py
+++ b/html5lib/serializer.py
@@ -222,14 +222,14 @@ def __init__(self, **kwargs):
self.strict = False
def encode(self, string):
- assert(isinstance(string, text_type))
+ assert isinstance(string, text_type)
if self.encoding:
return string.encode(self.encoding, "htmlentityreplace")
else:
return string
def encodeStrict(self, string):
- assert(isinstance(string, text_type))
+ assert isinstance(string, text_type)
if self.encoding:
return string.encode(self.encoding, "strict")
else:
diff --git a/html5lib/tests/test_serializer.py b/html5lib/tests/test_serializer.py
index bce62459..a2be0be5 100644
--- a/html5lib/tests/test_serializer.py
+++ b/html5lib/tests/test_serializer.py
@@ -74,7 +74,7 @@ def _convertAttrib(self, attribs):
attrs = {}
for attrib in attribs:
name = (attrib["namespace"], attrib["name"])
- assert(name not in attrs)
+ assert name not in attrs
attrs[name] = attrib["value"]
return attrs
diff --git a/html5lib/treebuilders/etree.py b/html5lib/treebuilders/etree.py
index 086bed4e..0b745081 100644
--- a/html5lib/treebuilders/etree.py
+++ b/html5lib/treebuilders/etree.py
@@ -108,7 +108,7 @@ def removeChild(self, node):
node.parent = None
def insertText(self, data, insertBefore=None):
- if not(len(self._element)):
+ if not len(self._element):
if not self._element.text:
self._element.text = ""
self._element.text += data
@@ -201,7 +201,7 @@ def testSerializer(element):
rv = []
def serializeElement(element, indent=0):
- if not(hasattr(element, "tag")):
+ if not hasattr(element, "tag"):
element = element.getroot()
if element.tag == "":
if element.get("publicId") or element.get("systemId"):
diff --git a/html5lib/treewalkers/etree.py b/html5lib/treewalkers/etree.py
index 44653372..411a1d45 100644
--- a/html5lib/treewalkers/etree.py
+++ b/html5lib/treewalkers/etree.py
@@ -37,7 +37,7 @@ def getNodeDetails(self, node):
else:
node = elt
- if not(hasattr(node, "tag")):
+ if not hasattr(node, "tag"):
node = node.getroot()
if node.tag in ("DOCUMENT_ROOT", "DOCUMENT_FRAGMENT"):
diff --git a/requirements-test.txt b/requirements-test.txt
index 57f8f617..8c0ca7c7 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,7 +1,7 @@
-r requirements.txt
tox>=3.15.1,<4
-flake8>=3.8.1,<3.9
+flake8>=3.8.1,<6
pytest>=4.6.10,<5 ; python_version < '3'
pytest>=5.4.2,<7 ; python_version >= '3'
coverage>=5.1,<6