mirror of
https://github.com/httpie/cli.git
synced 2025-01-22 13:29:00 +01:00
Fix XML formatter tests
This commit is contained in:
parent
6c501d23c3
commit
fdd486415a
@ -16,7 +16,7 @@ def parse_xml(data: str) -> 'Document':
|
||||
|
||||
def pretty_xml(document: 'Document',
|
||||
encoding: Optional[str] = UTF8,
|
||||
indent: int = 4,
|
||||
indent: int = 2,
|
||||
standalone: Optional[bool] = None) -> str:
|
||||
"""Render the given :class:`~xml.dom.minidom.Document` `document` into a prettified string."""
|
||||
kwargs = {
|
||||
|
@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html
|
||||
PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
|
||||
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
|
||||
|
@ -379,7 +379,7 @@ class TestFormatOptions:
|
||||
},
|
||||
'xml': {
|
||||
'format': True,
|
||||
'indent': 4,
|
||||
'indent': 2,
|
||||
},
|
||||
}
|
||||
),
|
||||
@ -398,7 +398,7 @@ class TestFormatOptions:
|
||||
},
|
||||
'xml': {
|
||||
'format': True,
|
||||
'indent': 4,
|
||||
'indent': 2,
|
||||
},
|
||||
}
|
||||
),
|
||||
@ -419,7 +419,7 @@ class TestFormatOptions:
|
||||
},
|
||||
'xml': {
|
||||
'format': True,
|
||||
'indent': 4,
|
||||
'indent': 2,
|
||||
},
|
||||
}
|
||||
),
|
||||
@ -436,7 +436,7 @@ class TestFormatOptions:
|
||||
[
|
||||
'--format-options=json.indent:2',
|
||||
'--format-options=xml.format:false',
|
||||
'--format-options=xml.indent:2',
|
||||
'--format-options=xml.indent:4',
|
||||
'--unsorted',
|
||||
'--no-unsorted',
|
||||
],
|
||||
@ -451,7 +451,7 @@ class TestFormatOptions:
|
||||
},
|
||||
'xml': {
|
||||
'format': False,
|
||||
'indent': 2,
|
||||
'indent': 4,
|
||||
},
|
||||
}
|
||||
),
|
||||
@ -472,7 +472,7 @@ class TestFormatOptions:
|
||||
},
|
||||
'xml': {
|
||||
'format': True,
|
||||
'indent': 4,
|
||||
'indent': 2,
|
||||
},
|
||||
}
|
||||
),
|
||||
@ -494,7 +494,7 @@ class TestFormatOptions:
|
||||
},
|
||||
'xml': {
|
||||
'format': True,
|
||||
'indent': 4,
|
||||
'indent': 2,
|
||||
},
|
||||
}
|
||||
),
|
||||
|
@ -16,8 +16,8 @@ SAMPLE_XML_DATA = '<?xml version="1.0" encoding="utf-8"?><root><e>text</e></root
|
||||
'options, expected_xml',
|
||||
[
|
||||
('xml.format:false', SAMPLE_XML_DATA),
|
||||
('xml.indent:2', pretty_xml(parse_xml(SAMPLE_XML_DATA), indent=2)),
|
||||
('xml.indent:4', pretty_xml(parse_xml(SAMPLE_XML_DATA))),
|
||||
('xml.indent:2', pretty_xml(parse_xml(SAMPLE_XML_DATA))),
|
||||
('xml.indent:4', pretty_xml(parse_xml(SAMPLE_XML_DATA), indent=4)),
|
||||
]
|
||||
)
|
||||
@responses.activate
|
||||
@ -70,7 +70,6 @@ def test_xml_xhtml():
|
||||
content_type='application/xhtml+xml')
|
||||
|
||||
r = http(url)
|
||||
print(r)
|
||||
assert expected_xml_output in r
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user