mathjson-solver 1.9.0__tar.gz → 1.9.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mathjson-solver
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: Utilities for MathJSON evaluation
5
5
  Home-page: https://github.com/LongenesisLtd/mathjson-solver
6
6
  Author: Martins Mednis
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = mathjson-solver
3
- version = 1.9.0
3
+ version = 1.9.1
4
4
  author = Martins Mednis
5
5
  author_email = mrt@mednis.info
6
6
  description = Utilities for MathJSON evaluation
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="mathjson-solver",
8
- version="1.9.0",
8
+ version="1.9.1",
9
9
  author="Martins Mednis",
10
10
  author_email="mrt@mednis.info",
11
11
  description="Utilities for MathJSON evaluation",
@@ -487,6 +487,11 @@ def extract_variables(s: Union[list, int, float, str], li: set, ignore_list: set
487
487
  ignore_list.add(x[0])
488
488
  li.update(extract_variables(x[1], li, ignore_list))
489
489
  li.update(extract_variables(x[-1], li, ignore_list))
490
+ elif s[0] == "If":
491
+ for elif_block in s[1:-1]: # s[1] is list
492
+ for x in elif_block:
493
+ li.update(extract_variables(x, li, ignore_list))
494
+ li.update(extract_variables(s[-1], li, ignore_list))
490
495
  else:
491
496
  for x in s[1:]:
492
497
  li.update(extract_variables(x, li, ignore_list))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mathjson-solver
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: Utilities for MathJSON evaluation
5
5
  Home-page: https://github.com/LongenesisLtd/mathjson-solver
6
6
  Author: Martins Mednis
@@ -319,6 +319,21 @@ def test_handle_exception():
319
319
  ["Add", "[slug1][0][question1]", "y", 4, "[slug1][-3:-1][question1]"],
320
320
  set(["[slug1][0][question1]", "y", "[slug1][-3:-1][question1]"]),
321
321
  ),
322
+ (
323
+ {},
324
+ ["If", [["Equal", "[uzwuoy][-1][question1]", 200], 200], 1],
325
+ set(["[uzwuoy][-1][question1]"]),
326
+ ),
327
+ (
328
+ {},
329
+ [
330
+ "If",
331
+ [["Equal", "[uzwuoy][-1][question1]", 200], 201],
332
+ [["Equal", "[uzwuoy][-2][question1]", 100], 101],
333
+ 1,
334
+ ],
335
+ set(["[uzwuoy][-1][question1]", "[uzwuoy][-2][question1]"]),
336
+ ),
322
337
  ],
323
338
  )
324
339
  def test_extract_variables(parameters, expression, expected_result):
File without changes