Skip to content

Commit

Permalink
Get tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleysommer committed Nov 7, 2024
1 parent 083d9e9 commit 01ba6b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions html5rdf/_tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ def markupDeclarationOpenState(self):
break
if matched:
self.currentToken = {"type": tokenTypes["Doctype"],
"name": "",
"name": None,
"publicId": None, "systemId": None,
"correct": True}
self.state = self.doctypeState
Expand Down Expand Up @@ -1702,6 +1702,7 @@ def bogusDoctypeState(self):
return True

def cdataSectionState(self):
rewrite_nulls = False
data = []
while True:
data.append(self.stream.charsUntil("]"))
Expand All @@ -1724,7 +1725,8 @@ def cdataSectionState(self):
for _ in range(nullCount):
self.tokenQueue.append({"type": tokenTypes["ParseError"],
"data": "invalid-codepoint"})
data = data.replace("\u0000", "\uFFFD")
if rewrite_nulls:
data = data.replace("\u0000", "\uFFFD")
if data:
self.tokenQueue.append({"type": tokenTypes["Characters"],
"data": data})
Expand Down
4 changes: 3 additions & 1 deletion html5rdf/tests/tree_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ def runtest(self):
def repr_failure(self, excinfo: "pytest._code.code.ExceptionInfo[BaseException]", *args):
traceback = excinfo.traceback
ntraceback = traceback.cut(path=__file__)
excinfo.traceback = ntraceback.filter(excinfo)
pytest_ver = getattr(pytest, "version_tuple", ())
filter_args = (excinfo,) if pytest_ver >= (7, 4, 0) else ()
excinfo.traceback = ntraceback.filter(*filter_args)

return excinfo.getrepr(funcargs=True,
showlocals=False,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def default_environment():
if (len(a.targets) == 1 and
isinstance(a.targets[0], ast.Name) and
a.targets[0].id == "__version__" and
isinstance(a.value, ast.Str)):
isinstance(a.value, ast.Constant)):
version = a.value.s

setup(name='html5rdf',
Expand Down

0 comments on commit 01ba6b4

Please sign in to comment.