From 89b81f97c8aace525fc21ee7231dc26c7b5b54c0 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand Date: Sun, 17 Jan 2016 18:06:42 +0300 Subject: [PATCH] Add test for random_expression and underscore --- pymath/calculus/test/test_random_expression.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pymath/calculus/test/test_random_expression.py b/pymath/calculus/test/test_random_expression.py index 9cbdb68..ed986d2 100644 --- a/pymath/calculus/test/test_random_expression.py +++ b/pymath/calculus/test/test_random_expression.py @@ -17,6 +17,17 @@ def test_only_form(): assert set(rdExp._gene_varia.keys()) == {'a'} assert set(rdExp._gene_2replaced.keys()) == {'a'} +def test_form_with_underscores(): + form = "_ + 2*_" + rdExp = RdExpression(form) + + assert rdExp._letters == {'A', 'B'} + assert rdExp._2replaced == {'A', 'B'} + + rdExp() + assert set(rdExp._gene_varia.keys()) == {'A', 'B'} + assert set(rdExp._gene_2replaced.keys()) == {'A', 'B'} + def test_only_form_calc(): form = "{a+b} + 2" rdExp = RdExpression(form)