test(Doclang): add chart serialization test (#498)

Signed-off-by: Panos Vagenas <pva@zurich.ibm.com>
This commit is contained in:
Panos Vagenas
2026-02-13 10:31:20 +01:00
committed by GitHub
parent 1d969d4e37
commit 134cf75b69
2 changed files with 81 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
<doclang version="1.0.0">
<page_header>
<location value="73"/>
<location value="14"/>
<location value="222"/>
<location value="20"/>
Probability, Combinatorics and Control
</page_header>
<floating_group class="picture">
<picture>
<meta>
<classification>Bar chart</classification>
</meta>
<location value="104"/>
<location value="38"/>
<location value="401"/>
<location value="152"/>
<otsl>
<fcel/>
Number of impellers
<fcel/>
single-frequency
<fcel/>
multi-frequency
<nl/>
<fcel/>
1
<fcel/>
0.06
<fcel/>
0.16
<nl/>
<fcel/>
2
<fcel/>
0.12
<fcel/>
0.26
<nl/>
<fcel/>
3
<fcel/>
0.16
<fcel/>
0.27
<nl/>
<fcel/>
4
<fcel/>
0.14
<fcel/>
0.26
<nl/>
<fcel/>
5
<fcel/>
0.16
<fcel/>
0.25
<nl/>
<fcel/>
6
<fcel/>
0.24
<fcel/>
0.24
<nl/>
</otsl>
</picture>
</floating_group>
</doclang>
+10
View File
@@ -677,3 +677,13 @@ def test_def_prov_256():
ser_txt = ser_res.text
exp_file = Path("./test/data/doc/simple_prov_res_256.out.dclg.xml")
verify(exp_file=exp_file, actual=ser_txt)
def test_chart():
doc = DoclingDocument.load_from_json("./test/data/doc/barchart.json")
ser = DoclangDocSerializer(
doc=doc,
)
ser_res = ser.serialize()
ser_txt = ser_res.text
exp_file = Path("./test/data/doc/barchart.out.dclg.xml")
verify(exp_file=exp_file, actual=ser_txt)