work around a change in python 3.13

* python/spot/__init__.py: Unindent the docstring for
formula.__format__.  Because Python 3.13 strips the indentation but
previous version didn't, the following test case failed with Python
3.13.
* tests/python/formulas.ipynb: Adjust to unindented docstring.
This commit is contained in:
Alexandre Duret-Lutz 2025-01-01 21:46:35 +01:00
parent c971ce57a6
commit 461dc842e9
2 changed files with 69 additions and 64 deletions

View file

@ -360,6 +360,11 @@ class formula:
raise ValueError("unknown string format: " + format) raise ValueError("unknown string format: " + format)
def __format__(self, spec): def __format__(self, spec):
# Some test case print this docstring, and different
# Python version will handled indentation differently.
# (Python versions before 3.13 don't strip indentation.)
# So we cannot indent this until Python 3.13 is thee
# smallest version we support.
"""Format the formula according to `spec`. """Format the formula according to `spec`.
Parameters Parameters

View file

@ -505,7 +505,7 @@
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.43.0 (0)\n", "<!-- Generated by graphviz version 2.42.4 (0)\n",
" -->\n", " -->\n",
"<!-- Title: G Pages: 1 -->\n", "<!-- Title: G Pages: 1 -->\n",
"<svg width=\"343pt\" height=\"583pt\"\n", "<svg width=\"343pt\" height=\"583pt\"\n",
@ -1056,7 +1056,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.8" "version": "3.12.7"
} }
}, },
"nbformat": 4, "nbformat": 4,