From 5b7c9d412c9e50d1cc72b329aa3aeb944f830a91 Mon Sep 17 00:00:00 2001 From: Lafrite Date: Mon, 22 Dec 2014 11:03:44 +0100 Subject: [PATCH] test on str2tokens with poly --- test/test_str2tokens.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_str2tokens.py b/test/test_str2tokens.py index 25aa0e9..89a872f 100644 --- a/test/test_str2tokens.py +++ b/test/test_str2tokens.py @@ -43,6 +43,22 @@ class TestStr2tokens(unittest.TestCase): tok = str2in_tokens(exp) self.assertEqual(tok, ["(", -3, ")", "*","(", 2, ")" ]) + def test_str2tokens_poly(self): + exp = "2x + 4" + post = str2in_tokens(exp) + self.assertEqual(post, [2, < Polynom [0, 1]>, '*', 4, '+']) + + + def test_str2tokens_poly_double_x(self): + exp = "xx + 4" + post = str2in_tokens(exp) + self.assertEqual(post, [< Polynom [0, 1]>, < Polynom [0, 1]>, '*', 4, '+']) + + def test_str2tokens_poly(self): + exp = "x(2+1) + 4" + post = str2in_tokens(exp) + self.assertEqual(post, [< Polynom [0, 1]>, 2, 1, '+', '*', 4, '+']) + def test_str2in_tokens_time_lack2(self): exp = "-3(2)" tok = str2in_tokens(exp)