From 2aed89855f5bf7c0d1f42e5f929e710fe020d933 Mon Sep 17 00:00:00 2001 From: Lafrite Date: Sun, 23 Nov 2014 08:29:02 +0100 Subject: [PATCH] Add on test in test_random_expression --- test/test_random_expression.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/test_random_expression.py b/test/test_random_expression.py index f69a627..bed6114 100644 --- a/test/test_random_expression.py +++ b/test/test_random_expression.py @@ -77,9 +77,18 @@ class TestRandomExpression(unittest.TestCase): def test_only_form_calc_cond_calc(self): - form = "{a} + 2" + form = "{a*3} * {b}" + cond = ["{a + b} == 3"] + rdExp = RdExpression(form, cond) - pass + self.assertEqual(rdExp._letters, {'a', 'b'}) + self.assertEqual(rdExp._2replaced, {'b', 'a*3', 'a + b'}) + + rdExp() + self.assertEqual(set(rdExp._gene_varia.keys()), {'a', 'b'}) + self.assertEqual(set(rdExp._gene_2replaced.keys()), {'b', 'a*3', 'a + b'}) + + self.assertEqual((rdExp._gene_varia['a'] + rdExp._gene_varia['b']), 3)