From 202d934d67633cc1b2b2a254db05369af5081a9d Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 14 Apr 2025 00:42:19 +0200 Subject: [PATCH] test for readme example added --- tests/test_readme_example.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/test_readme_example.py diff --git a/tests/test_readme_example.py b/tests/test_readme_example.py new file mode 100644 index 0000000..613fbdf --- /dev/null +++ b/tests/test_readme_example.py @@ -0,0 +1,31 @@ +import pyladoc +import pandas as pd + +def test_readme_example(): + doc = pyladoc.DocumentWriter() + + doc.add_markdown(""" + # Example + This is inline LaTeX: $$\\lambda$$ + + This is a LaTeX block with a number: + $$ + \\label{eq:test1} + \\lambda_{\text{mix}} = \\sum_{i=1}^{n} \\frac{x_i \\lambda_i}{\\sum_{j=1}^{n} x_j \\Phi_{ij}} + $$ + + This is an example table. The table @table:pandas_example shows some random data. + """) + + some_data = { + 'Row1': ["Line1", "Line2", "Line3"], + 'Row2': [120, 100, 110], + 'Row3': ['12 g/km', '> 150 g/km', '110 g/km'] + } + df = pd.DataFrame(some_data) + doc.add_table(df, 'This is a pandas example table', 'pandas_example') + + html_code = doc.to_html() + print(html_code) + + assert '