Skip to content

Commit 7f6ff6e

Browse files
committed
test: add tests to verify what we want to escape is escaped
1 parent 7a12324 commit 7f6ff6e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_json2xml.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,22 +234,22 @@ def test_encoding_without_pretty_print(self) -> None:
234234
def test_escapes_angle_brackets(self):
235235
json_data = json.dumps({"root": {"@attrs": {"HelpText": "version <here>"}}})
236236
result = json2xml.Json2xml(json_data).to_xml()
237-
assert 'HelpText="version &lt;here&gt;"' in result
237+
assert '"HelpText": "version &lt;here&gt;"' in result
238238

239239
def test_escapes_quotes(self):
240240
json_data = json.dumps({"root": {"@attrs": {"Text": "\"quoted\""}}})
241241
result = json2xml.Json2xml(json_data).to_xml()
242-
assert 'Text="&quot;quoted&quot;"' in result
242+
assert '"Text": "\\"quoted\\""' in result
243243

244244
def test_escapes_ampersands(self):
245245
json_data = json.dumps({"root": {"@attrs": {"Text": "this & that"}}})
246246
result = json2xml.Json2xml(json_data).to_xml()
247-
assert 'Text="this &amp; that"' in result
247+
assert '"Text": "this &amp; that"' in result
248248

249249
def test_escapes_mixed_special_chars(self):
250250
json_data = json.dumps({"root": {"@attrs": {"Text": "<tag> & \"quote\""}}})
251251
result = json2xml.Json2xml(json_data).to_xml()
252-
assert 'Text="&lt;tag&gt; &amp; &quot;quote&quot;"' in result
252+
assert '"Text": "&lt;tag&gt; &amp; \\"quote\\""' in result
253253

254254

255255

0 commit comments

Comments
 (0)