ixbrl-viewer 1.4.68__py3-none-any.whl → 1.4.70__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ixbrl-viewer might be problematic. Click here for more details.
- iXBRLViewerPlugin/_version.py +2 -2
- iXBRLViewerPlugin/viewer/dist/ixbrlviewer.js +1 -1
- {ixbrl_viewer-1.4.68.dist-info → ixbrl_viewer-1.4.70.dist-info}/METADATA +3 -4
- {ixbrl_viewer-1.4.68.dist-info → ixbrl_viewer-1.4.70.dist-info}/RECORD +9 -29
- {ixbrl_viewer-1.4.68.dist-info → ixbrl_viewer-1.4.70.dist-info}/top_level.txt +0 -1
- tests/__init__.py +0 -0
- tests/puppeteer/framework/core_elements.js +0 -117
- tests/puppeteer/framework/page_objects/doc_frame.js +0 -105
- tests/puppeteer/framework/page_objects/fact_details_panel.js +0 -112
- tests/puppeteer/framework/page_objects/search_panel.js +0 -73
- tests/puppeteer/framework/page_objects/toolbar.js +0 -18
- tests/puppeteer/framework/utils.js +0 -3
- tests/puppeteer/framework/viewer_page.js +0 -103
- tests/puppeteer/puppeteer_test_run_via_intellij.jpg +0 -0
- tests/puppeteer/test_filings/filing_documents_smoke_test.zip +0 -0
- tests/puppeteer/test_filings/highlights.zip +0 -0
- tests/puppeteer/tests/fact_properties.test.js +0 -84
- tests/puppeteer/tests/highlight.test.js +0 -186
- tests/puppeteer/tests/search.test.js +0 -86
- tests/puppeteer/tools/generate.sh +0 -15
- tests/unit_tests/__init__.py +0 -0
- tests/unit_tests/iXBRLViewerPlugin/__init__.py +0 -0
- tests/unit_tests/iXBRLViewerPlugin/mock_arelle.py +0 -41
- tests/unit_tests/iXBRLViewerPlugin/test_iXBRLViewer.py +0 -801
- tests/unit_tests/iXBRLViewerPlugin/test_xhtmlserialize.py +0 -310
- {ixbrl_viewer-1.4.68.dist-info → ixbrl_viewer-1.4.70.dist-info}/WHEEL +0 -0
- {ixbrl_viewer-1.4.68.dist-info → ixbrl_viewer-1.4.70.dist-info}/entry_points.txt +0 -0
- {ixbrl_viewer-1.4.68.dist-info → ixbrl_viewer-1.4.70.dist-info}/licenses/LICENSE.md +0 -0
- {ixbrl_viewer-1.4.68.dist-info → ixbrl_viewer-1.4.70.dist-info}/licenses/NOTICE +0 -0
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import io
|
|
2
|
-
|
|
3
|
-
import lxml
|
|
4
|
-
|
|
5
|
-
from .mock_arelle import mock_arelle
|
|
6
|
-
|
|
7
|
-
mock_arelle()
|
|
8
|
-
|
|
9
|
-
from iXBRLViewerPlugin.xhtmlserialize import XHTMLSerializer
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class TestXHTMLSerializer:
|
|
13
|
-
|
|
14
|
-
def _html(self, s):
|
|
15
|
-
return '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>%s</body></html>' % s
|
|
16
|
-
|
|
17
|
-
def _serialiseToString(self, xml, xml_declaration = False):
|
|
18
|
-
buf = io.BytesIO()
|
|
19
|
-
serializer = XHTMLSerializer(buf, xml_declaration)
|
|
20
|
-
serializer.serialize(xml)
|
|
21
|
-
return buf.getvalue().decode('utf-8')
|
|
22
|
-
|
|
23
|
-
def _checkTagExpansion(self, html_in, html_out):
|
|
24
|
-
doc = lxml.etree.fromstring(self._html(html_in))
|
|
25
|
-
assert self._serialiseToString(doc) == self._html(html_out)
|
|
26
|
-
|
|
27
|
-
def test_expandEmptyTags(self):
|
|
28
|
-
self._checkTagExpansion('<div/>', '<div></div>')
|
|
29
|
-
self._checkTagExpansion('<div><span class="fish" /></div>', '<div><span class="fish"></span></div>')
|
|
30
|
-
|
|
31
|
-
# Non-expanding tags
|
|
32
|
-
self._checkTagExpansion('<br/>', '<br/>')
|
|
33
|
-
self._checkTagExpansion('<br />', '<br/>')
|
|
34
|
-
self._checkTagExpansion('<hr/>', '<hr/>')
|
|
35
|
-
self._checkTagExpansion('<img />', '<img/>')
|
|
36
|
-
|
|
37
|
-
# Mixed content
|
|
38
|
-
self._checkTagExpansion('<div>foo<p /><p>bar</p></div>', '<div>foo<p></p><p>bar</p></div>')
|
|
39
|
-
|
|
40
|
-
# Expanded tags that should be empty will be collapsed
|
|
41
|
-
self._checkTagExpansion('<br></br>', '<br/>')
|
|
42
|
-
|
|
43
|
-
# Only expand tags in the XHTML namespace
|
|
44
|
-
self._checkTagExpansion('<div xmlns="other" />', '<div xmlns="other"></div>')
|
|
45
|
-
|
|
46
|
-
def test_serialize(self):
|
|
47
|
-
htmlsrc = self._html("<p>hello</p>")
|
|
48
|
-
doc = lxml.etree.fromstring(htmlsrc)
|
|
49
|
-
f = io.BytesIO()
|
|
50
|
-
|
|
51
|
-
writer = XHTMLSerializer(f)
|
|
52
|
-
writer.serialize(doc)
|
|
53
|
-
|
|
54
|
-
# XML declaration should be added.
|
|
55
|
-
assert f.getvalue().decode('utf-8') == '<?xml version="1.0" encoding="utf-8"?>\n' + htmlsrc
|
|
56
|
-
|
|
57
|
-
def test_custom_xml_serializer(self):
|
|
58
|
-
tests = (
|
|
59
|
-
# Self-closable elements should be collapsed
|
|
60
|
-
(
|
|
61
|
-
r'''<div><br></br><span></span></div>''',
|
|
62
|
-
r'''<div><br/><span></span></div>'''
|
|
63
|
-
),
|
|
64
|
-
|
|
65
|
-
# Non-self-closable element should be expanded
|
|
66
|
-
(
|
|
67
|
-
r'''<div><span/></div>''',
|
|
68
|
-
r'''<div><span></span></div>'''
|
|
69
|
-
),
|
|
70
|
-
|
|
71
|
-
# > is usually escaped
|
|
72
|
-
(
|
|
73
|
-
r'''<div> <foo> <bar> & </div>''',
|
|
74
|
-
r'''<div> <foo> <bar> & </div>'''
|
|
75
|
-
),
|
|
76
|
-
|
|
77
|
-
# > is not escaped in a style tag
|
|
78
|
-
(
|
|
79
|
-
r'''<style>div > p { color: #777 }</style>''',
|
|
80
|
-
r'''<style>div > p { color: #777 }</style>''',
|
|
81
|
-
),
|
|
82
|
-
|
|
83
|
-
# < and & can appear in CSS string. We leave them as is, even
|
|
84
|
-
# thought this won't work in HTML mode
|
|
85
|
-
(
|
|
86
|
-
r'''<style>span::before { content: "<&" }</style>''',
|
|
87
|
-
r'''<style>span::before { content: "<&" }</style>''',
|
|
88
|
-
),
|
|
89
|
-
|
|
90
|
-
# also escaped this way in comments
|
|
91
|
-
(
|
|
92
|
-
r'''<style>span { color: #777 } /* <span> elements are styled this way */ </style>''',
|
|
93
|
-
r'''<style>span { color: #777 } /* <span> elements are styled this way */ </style>''',
|
|
94
|
-
),
|
|
95
|
-
|
|
96
|
-
(
|
|
97
|
-
r'''<div xmlns="http://www.w3.org/1999/xhtml"><svg xmlns="http://www.w3.org/2000/svg"></svg></div>''',
|
|
98
|
-
r'''<div xmlns="http://www.w3.org/1999/xhtml"><svg xmlns="http://www.w3.org/2000/svg"></svg></div>''',
|
|
99
|
-
),
|
|
100
|
-
(
|
|
101
|
-
r'''<xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml"><svg xmlns="http://www.w3.org/2000/svg"></svg></xhtml:div>''',
|
|
102
|
-
r'''<xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml"><svg xmlns="http://www.w3.org/2000/svg"></svg></xhtml:div>''',
|
|
103
|
-
),
|
|
104
|
-
|
|
105
|
-
# Default and prefixed namespace for same URI. Choioce of prefix should be preserved
|
|
106
|
-
(
|
|
107
|
-
r'''<xhtml:div xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml"><svg xmlns="http://www.w3.org/2000/svg"></svg></xhtml:div>''',
|
|
108
|
-
r'''<xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"><svg xmlns="http://www.w3.org/2000/svg"></svg></xhtml:div>''',
|
|
109
|
-
),
|
|
110
|
-
|
|
111
|
-
# Default and prefixed namespace for same URI. Choioce of prefix should be preserved
|
|
112
|
-
(
|
|
113
|
-
r'''<div xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml"><svg xmlns="http://www.w3.org/2000/svg"></svg></div>''',
|
|
114
|
-
r'''<div xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"><svg xmlns="http://www.w3.org/2000/svg"></svg></div>''',
|
|
115
|
-
),
|
|
116
|
-
|
|
117
|
-
# Unprefixed attributes have no namespace, not default namespace
|
|
118
|
-
(
|
|
119
|
-
r'''<div xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml"><span bar="baz" xhtml:foo="bar"></span></div>''',
|
|
120
|
-
r'''<div xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"><span bar="baz" xhtml:foo="bar"></span></div>''',
|
|
121
|
-
),
|
|
122
|
-
|
|
123
|
-
# Text and tail and comment handling
|
|
124
|
-
(
|
|
125
|
-
r'''<div>Text<span>text</span>tail<!-- comment -->after comment<span>text</span>tail</div>''',
|
|
126
|
-
r'''<div>Text<span>text</span>tail<!-- comment -->after comment<span>text</span>tail</div>'''
|
|
127
|
-
),
|
|
128
|
-
|
|
129
|
-
# PI trailing space handling
|
|
130
|
-
(
|
|
131
|
-
r'''<div><?my-pi attr1="val1" attr2="val2" ?></div>''',
|
|
132
|
-
r'''<div><?my-pi attr1="val1" attr2="val2" ?></div>'''
|
|
133
|
-
),
|
|
134
|
-
|
|
135
|
-
(
|
|
136
|
-
r'''<div><?my-pi attr1="val1" attr2="val2"?></div>''',
|
|
137
|
-
r'''<div><?my-pi attr1="val1" attr2="val2"?></div>'''
|
|
138
|
-
),
|
|
139
|
-
|
|
140
|
-
(
|
|
141
|
-
r'''<div><?my-pi ?></div>''',
|
|
142
|
-
r'''<div><?my-pi?></div>'''
|
|
143
|
-
),
|
|
144
|
-
|
|
145
|
-
# attribute escaping
|
|
146
|
-
(
|
|
147
|
-
r'''<div attr1="'foo>&'">abc</div>''',
|
|
148
|
-
r'''<div attr1="'foo>&'">abc</div>''',
|
|
149
|
-
),
|
|
150
|
-
# Always uses double quotes
|
|
151
|
-
(
|
|
152
|
-
r'''<div attr1='"foo"'>abc</div>''',
|
|
153
|
-
r'''<div attr1=""foo"">abc</div>''',
|
|
154
|
-
),
|
|
155
|
-
# xml prefix doesn't need declaring
|
|
156
|
-
(
|
|
157
|
-
r'''<div xml:lang="en" attr='abc'>abc</div>''',
|
|
158
|
-
r'''<div attr="abc" xml:lang="en">abc</div>''',
|
|
159
|
-
),
|
|
160
|
-
# control characters escaped
|
|
161
|
-
(
|
|
162
|
-
r'''<div foo="€">abc</div>''',
|
|
163
|
-
r'''<div foo="€">abc</div>''',
|
|
164
|
-
),
|
|
165
|
-
(
|
|
166
|
-
# whitespace preservation
|
|
167
|
-
r'''<div>
|
|
168
|
-
<br></br>
|
|
169
|
-
<span></span>
|
|
170
|
-
</div>''',
|
|
171
|
-
r'''<div>
|
|
172
|
-
<br/>
|
|
173
|
-
<span></span>
|
|
174
|
-
</div>'''
|
|
175
|
-
),
|
|
176
|
-
(
|
|
177
|
-
# whitespace preservation
|
|
178
|
-
# we can't test \r here, because lxml appears to convert
|
|
179
|
-
# literal \r => \n (on unix) so the round trip fails
|
|
180
|
-
'<div>
/	</div>',
|
|
181
|
-
'<div>\n/\t</div>',
|
|
182
|
-
),
|
|
183
|
-
(
|
|
184
|
-
# ]]> is the one case where we do escape '>' in a style tag.
|
|
185
|
-
'<div>]]><style>]]></style></div>',
|
|
186
|
-
'<div>]]><style>]]></style></div>',
|
|
187
|
-
),
|
|
188
|
-
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
for (test_in, test_out) in tests:
|
|
193
|
-
x = lxml.etree.fromstring(test_in)
|
|
194
|
-
s = self._serialiseToString(x)
|
|
195
|
-
assert s == test_out
|
|
196
|
-
|
|
197
|
-
# Round trip
|
|
198
|
-
x2 = lxml.etree.fromstring(s)
|
|
199
|
-
assert self._serialiseToString(x2) == s
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
def test_full_document_serialisation(self):
|
|
203
|
-
tests = (
|
|
204
|
-
# Self-closable elements should be collapsed
|
|
205
|
-
(
|
|
206
|
-
# Comment before body is preserved, but trailing whitespace normalised to single newline
|
|
207
|
-
r'''<?xml version="1.0" ?>
|
|
208
|
-
<!-- comment -->
|
|
209
|
-
<div><br></br><span></span></div>''',
|
|
210
|
-
r'''<!-- comment -->
|
|
211
|
-
<div><br/><span></span></div>'''
|
|
212
|
-
),
|
|
213
|
-
(
|
|
214
|
-
# Comment before body is preserved, but trailing whitespace normalised to single newline
|
|
215
|
-
r'''
|
|
216
|
-
|
|
217
|
-
<!-- comment -->
|
|
218
|
-
<div><br></br><span></span></div>''',
|
|
219
|
-
r'''<!-- comment -->
|
|
220
|
-
<div><br/><span></span></div>'''
|
|
221
|
-
),
|
|
222
|
-
(
|
|
223
|
-
# whitespace preservation
|
|
224
|
-
'<div>
/
/	</div>',
|
|
225
|
-
'<div>\r/\n/\t</div>',
|
|
226
|
-
),
|
|
227
|
-
)
|
|
228
|
-
|
|
229
|
-
for (test_in, test_out) in tests:
|
|
230
|
-
f = io.BytesIO(test_in.encode('utf-8'))
|
|
231
|
-
x = lxml.etree.parse(f)
|
|
232
|
-
s = self._serialiseToString(x)
|
|
233
|
-
assert s == test_out
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
def test_full_document_serialisation_with_xml_declaration(self):
|
|
237
|
-
tests = (
|
|
238
|
-
# Self-closable elements should be collapsed
|
|
239
|
-
(
|
|
240
|
-
r'''<?xml version="1.0" ?>
|
|
241
|
-
<!-- comment -->
|
|
242
|
-
<?pi?>
|
|
243
|
-
<div><br></br><span></span></div>''',
|
|
244
|
-
|
|
245
|
-
r'''<?xml version="1.0" encoding="utf-8"?>
|
|
246
|
-
<!-- comment -->
|
|
247
|
-
<?pi?>
|
|
248
|
-
<div><br/><span></span></div>'''
|
|
249
|
-
),
|
|
250
|
-
(
|
|
251
|
-
r'''
|
|
252
|
-
<!-- comment -->
|
|
253
|
-
<div><br></br><span></span></div>''',
|
|
254
|
-
|
|
255
|
-
r'''<?xml version="1.0" encoding="utf-8"?>
|
|
256
|
-
<!-- comment -->
|
|
257
|
-
<div><br/><span></span></div>'''
|
|
258
|
-
),
|
|
259
|
-
(
|
|
260
|
-
r'''<?xml version="1.0" standalone="yes" ?>
|
|
261
|
-
<div></div>''',
|
|
262
|
-
r'''<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
|
263
|
-
<div></div>''',
|
|
264
|
-
),
|
|
265
|
-
(
|
|
266
|
-
r'''<?xml version="1.1" standalone="no" ?>
|
|
267
|
-
<div></div>''',
|
|
268
|
-
r'''<?xml version="1.1" encoding="utf-8"?>
|
|
269
|
-
<div></div>''',
|
|
270
|
-
),
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
for (test_in, test_out) in tests:
|
|
274
|
-
f = io.BytesIO(test_in.encode('utf-8'))
|
|
275
|
-
x = lxml.etree.parse(f)
|
|
276
|
-
s = self._serialiseToString(x, xml_declaration=True)
|
|
277
|
-
assert s == test_out
|
|
278
|
-
|
|
279
|
-
def test_document_modification(self):
|
|
280
|
-
tests = (
|
|
281
|
-
(
|
|
282
|
-
# lxml allocates new prefixes for new element, and for namespace attribute (which can't use the default NS)
|
|
283
|
-
r'''<div xmlns="http://www.example.com"><span>foo</span></div>''',
|
|
284
|
-
r'''<div xmlns="http://www.example.com"><span>foo</span><ns0:abc xmlns:ns0="http://www.example.com/ns2" xmlns:ns1="http://www.example.com" ns1:attr="def"></ns0:abc></div>'''
|
|
285
|
-
),
|
|
286
|
-
(
|
|
287
|
-
# lxml allocates new ns0 prefix to new element, overriding previous binding, and allocates ns1 for the attribute
|
|
288
|
-
r'''<ns0:div xmlns:ns0="http://www.example.com"><span>foo</span></ns0:div>''',
|
|
289
|
-
r'''<ns0:div xmlns:ns0="http://www.example.com"><span>foo</span><ns0:abc xmlns:ns0="http://www.example.com/ns2" xmlns:ns1="http://www.example.com" ns1:attr="def"></ns0:abc></ns0:div>'''
|
|
290
|
-
),
|
|
291
|
-
(
|
|
292
|
-
# newly allocated ns0 doesn't override abc binding, so it can be re-used for the attribute
|
|
293
|
-
r'''<abc:div xmlns:abc="http://www.example.com"><span>foo</span></abc:div>''',
|
|
294
|
-
r'''<abc:div xmlns:abc="http://www.example.com"><span>foo</span><ns0:abc xmlns:ns0="http://www.example.com/ns2" abc:attr="def"></ns0:abc></abc:div>'''
|
|
295
|
-
),
|
|
296
|
-
(
|
|
297
|
-
# newly allocated ns0 doesn't override abc binding, so it can be re-used for the attribute
|
|
298
|
-
r'''<abc:div xmlns:abc="http://www.example.com/ns2"><span>foo</span></abc:div>''',
|
|
299
|
-
r'''<abc:div xmlns:abc="http://www.example.com/ns2"><span>foo</span><abc:abc xmlns:ns0="http://www.example.com" ns0:attr="def"></abc:abc></abc:div>'''
|
|
300
|
-
),
|
|
301
|
-
)
|
|
302
|
-
|
|
303
|
-
for (test_in, test_out) in tests:
|
|
304
|
-
f = io.BytesIO(test_in.encode('utf-8'))
|
|
305
|
-
x = lxml.etree.parse(f)
|
|
306
|
-
e = lxml.etree.Element("{http://www.example.com/ns2}abc")
|
|
307
|
-
x.getroot().append(e)
|
|
308
|
-
e.set("{http://www.example.com}attr", "def")
|
|
309
|
-
s = self._serialiseToString(x)
|
|
310
|
-
assert s == test_out
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|