can't put spaces in {} in random_expression
This commit is contained in:
parent
8485890fdf
commit
24fb46e3d0
@ -22,15 +22,15 @@ class TestRandomExpression(unittest.TestCase):
|
|||||||
self.assertEqual(set(rdExp._gene_2replaced.keys()), {'a'})
|
self.assertEqual(set(rdExp._gene_2replaced.keys()), {'a'})
|
||||||
|
|
||||||
def test_only_form_calc(self):
|
def test_only_form_calc(self):
|
||||||
form = "{a + b} + 2"
|
form = "{a+b} + 2"
|
||||||
rdExp = RdExpression(form)
|
rdExp = RdExpression(form)
|
||||||
|
|
||||||
self.assertEqual(rdExp._letters, {'a', 'b'})
|
self.assertEqual(rdExp._letters, {'a', 'b'})
|
||||||
self.assertEqual(rdExp._2replaced, {'a + b'})
|
self.assertEqual(rdExp._2replaced, {'a+b'})
|
||||||
|
|
||||||
rdExp()
|
rdExp()
|
||||||
self.assertEqual(set(rdExp._gene_varia.keys()), {'a', 'b'})
|
self.assertEqual(set(rdExp._gene_varia.keys()), {'a', 'b'})
|
||||||
self.assertEqual(set(rdExp._gene_2replaced.keys()), {'a + b'})
|
self.assertEqual(set(rdExp._gene_2replaced.keys()), {'a+b'})
|
||||||
|
|
||||||
def test_only_form_cond(self):
|
def test_only_form_cond(self):
|
||||||
form = "{a} + 2"
|
form = "{a} + 2"
|
||||||
@ -78,15 +78,15 @@ class TestRandomExpression(unittest.TestCase):
|
|||||||
|
|
||||||
def test_only_form_calc_cond_calc(self):
|
def test_only_form_calc_cond_calc(self):
|
||||||
form = "{a*3} * {b}"
|
form = "{a*3} * {b}"
|
||||||
cond = ["{a + b} == 3"]
|
cond = ["{a+b} == 3"]
|
||||||
rdExp = RdExpression(form, cond)
|
rdExp = RdExpression(form, cond)
|
||||||
|
|
||||||
self.assertEqual(rdExp._letters, {'a', 'b'})
|
self.assertEqual(rdExp._letters, {'a', 'b'})
|
||||||
self.assertEqual(rdExp._2replaced, {'b', 'a*3', 'a + b'})
|
self.assertEqual(rdExp._2replaced, {'b', 'a*3', 'a+b'})
|
||||||
|
|
||||||
rdExp()
|
rdExp()
|
||||||
self.assertEqual(set(rdExp._gene_varia.keys()), {'a', 'b'})
|
self.assertEqual(set(rdExp._gene_varia.keys()), {'a', 'b'})
|
||||||
self.assertEqual(set(rdExp._gene_2replaced.keys()), {'b', 'a*3', '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)
|
self.assertEqual((rdExp._gene_varia['a'] + rdExp._gene_varia['b']), 3)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user