From 0ba5ebabef2e4ce9d5fa07549a6b0b09ab9fdc06 Mon Sep 17 00:00:00 2001 From: mgreminger Date: Wed, 8 Jan 2025 10:47:34 -0600 Subject: [PATCH] tests: add test for nested function calls with exponents and units --- public/dimensional_analysis.py | 1 - tests/test_basic.spec.mjs | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/public/dimensional_analysis.py b/public/dimensional_analysis.py index cfbd0b39..4ff90c6a 100644 --- a/public/dimensional_analysis.py +++ b/public/dimensional_analysis.py @@ -1496,7 +1496,6 @@ def get_next_id(self): global_placeholder_set = set(global_placeholder_map.keys()) dummy_var_placeholder_set = (Function('_Derivative'), Function('_Integral')) -dim_needs_values_wrapper_placeholder_set = (Function('_Pow'), Function('_IndexMatrix')) placeholder_inverse_map = { value["sympy_func"]: key for key, value in reversed(global_placeholder_map.items()) } placeholder_inverse_set = set(placeholder_inverse_map.keys()) diff --git a/tests/test_basic.spec.mjs b/tests/test_basic.spec.mjs index 7057420e..022aa743 100644 --- a/tests/test_basic.spec.mjs +++ b/tests/test_basic.spec.mjs @@ -750,6 +750,22 @@ test('Test function notation with exponents and units', async () => { }); +test('Test function notation with exponents and units and nested functions', async () => { + + await page.setLatex(0, String.raw`t\left(s=y\left(x=2\left\lbrack in\right\rbrack\right)\cdot1\left\lbrack in\right\rbrack\right)=`); + await page.click('#add-math-cell'); + await page.setLatex(1, String.raw`t=2^{\frac{s}{1\left\lbrack in\right\rbrack}}`); + await page.click('#add-math-cell'); + await page.setLatex(2, String.raw`y=3^{\frac{x}{1\left\lbrack in\right\rbrack}}`); + + await page.waitForSelector('text=Updating...', {state: 'detached'}); + + let content = await page.textContent('#result-value-0'); + expect(parseLatexFloat(content)).toBeCloseTo(512, precision-1); + content = await page.textContent('#result-units-0'); + expect(content).toBe(''); +}); + test('Test function notation with integrals', async () => {