Fix test_format_xml with dot in path

When the path contains dot ".", replacing all dots will generate a non-exist result and raises a FileNotFoundError. Replacing only the last dot fixes this.
This commit is contained in:
Felix Yan 2017-03-16 16:48:21 +08:00 committed by GitHub
parent b275257553
commit b352557092
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@ def test_format_xml(filename):
path = data.path(filename) path = data.path(filename)
with open(path) as f: with open(path) as f:
input = f.read() input = f.read()
with open(path.replace(".", "-formatted.")) as f: with open("-formatted.".join(path.rsplit(".", 1))) as f:
expected = f.read() expected = f.read()
tokens = xml_html.tokenize(input) tokens = xml_html.tokenize(input)
assert xml_html.format_xml(tokens) == expected assert xml_html.format_xml(tokens) == expected