From e43544006efc35effeb027a914cfb7624f2cfa74 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand Date: Sat, 13 Feb 2016 06:49:37 +0300 Subject: [PATCH] autopep8 on calculus test --- pymath/calculus/test/mass_test.py | 1528 ++++++++++++++++- pymath/calculus/test/test_arithmetic.py | 12 +- pymath/calculus/test/test_expression.py | 16 +- pymath/calculus/test/test_fraction.py | 63 +- pymath/calculus/test/test_generic.py | 16 +- pymath/calculus/test/test_operator.py | 76 +- pymath/calculus/test/test_polynom.py | 51 +- pymath/calculus/test/test_polynomDeg2.py | 8 - .../calculus/test/test_random_expression.py | 9 +- pymath/calculus/test/test_render.py | 288 ++-- pymath/calculus/test/test_str2tokens.py | 18 +- 11 files changed, 1805 insertions(+), 280 deletions(-) diff --git a/pymath/calculus/test/mass_test.py b/pymath/calculus/test/mass_test.py index 021ff84..ace7ab6 100644 --- a/pymath/calculus/test/mass_test.py +++ b/pymath/calculus/test/mass_test.py @@ -1,4 +1,1524 @@ -POLY_ADD_VALID_RESULTS = ['- x - 2 - 4', '- x - 2 + 2 x - 4', '- x - 2 + 4 x - 4', '- x - 2 - 4 x - 2', '- x - 2 - 2', '- x - 2 + 2 x - 2', '- x - 2 + 4 x - 2', '- x - 2 - 4 x', '- x - 2 - 2 x', '- x - 2 + 2 x', '- x - 2 + 4 x', '- x - 2 - 4 x + 2', '- x - 2 - 2 x + 2', '- x - 2 + 2', '- x - 2 + 4 x + 2', '- x - 2 - 4 x + 4', '- x - 2 - 2 x + 4', '- x - 2 + 4', '- x - 2 + 2 x + 4', '- 2 - 2 x - 4', '- 2 + 2 x - 4', '- 2 + 4 x - 4', '- 2 - 4 x - 2', '- 2 - 2', '- 2 + 2 x - 2', '- 2 + 4 x - 2', '- 2 - 4 x', '- 2 - 2 x', '- 2 + 2 x', '- 2 + 4 x', '- 2 - 4 x + 2', '- 2 - 2 x + 2', '- 2 + 2', '- 2 + 4 x + 2', '- 2 - 4 x + 4', '- 2 - 2 x + 4', '- 2 + 4', '- 2 + 2 x + 4', 'x - 2 - 2 x - 4', 'x - 2 - 4', 'x - 2 + 4 x - 4', 'x - 2 - 4 x - 2', 'x - 2 - 2', 'x - 2 + 2 x - 2', 'x - 2 + 4 x - 2', 'x - 2 - 4 x', 'x - 2 - 2 x', 'x - 2 + 2 x', 'x - 2 + 4 x', 'x - 2 - 4 x + 2', 'x - 2 - 2 x + 2', 'x - 2 + 2', 'x - 2 + 4 x + 2', 'x - 2 - 4 x + 4', 'x - 2 - 2 x + 4', 'x - 2 + 4', 'x - 2 + 2 x + 4', '2 x - 2 - 2 x - 4', '2 x - 2 - 4', '2 x - 2 + 2 x - 4', '2 x - 2 - 4 x - 2', '2 x - 2 - 2', '2 x - 2 + 2 x - 2', '2 x - 2 + 4 x - 2', '2 x - 2 - 4 x', '2 x - 2 - 2 x', '2 x - 2 + 2 x', '2 x - 2 + 4 x', '2 x - 2 - 4 x + 2', '2 x - 2 - 2 x + 2', '2 x - 2 + 2', '2 x - 2 + 4 x + 2', '2 x - 2 - 4 x + 4', '2 x - 2 - 2 x + 4', '2 x - 2 + 4', '2 x - 2 + 2 x + 4', '- 2 x - 1 - 2 x - 4', '- 2 x - 1 - 4', '- 2 x - 1 + 2 x - 4', '- 2 x - 1 + 4 x - 4', '- 2 x - 1 - 2', '- 2 x - 1 + 2 x - 2', '- 2 x - 1 + 4 x - 2', '- 2 x - 1 - 4 x', '- 2 x - 1 - 2 x', '- 2 x - 1 + 2 x', '- 2 x - 1 + 4 x', '- 2 x - 1 - 4 x + 2', '- 2 x - 1 - 2 x + 2', '- 2 x - 1 + 2', '- 2 x - 1 + 4 x + 2', '- 2 x - 1 - 4 x + 4', '- 2 x - 1 - 2 x + 4', '- 2 x - 1 + 4', '- 2 x - 1 + 2 x + 4', '- 1 - 2 x - 4', '- 1 - 4', '- 1 + 2 x - 4', '- 1 + 4 x - 4', '- 1 - 4 x - 2', '- 1 + 2 x - 2', '- 1 + 4 x - 2', '- 1 - 4 x', '- 1 - 2 x', '- 1 + 2 x', '- 1 + 4 x', '- 1 - 4 x + 2', '- 1 - 2 x + 2', '- 1 + 2', '- 1 + 4 x + 2', '- 1 - 4 x + 4', '- 1 - 2 x + 4', '- 1 + 4', '- 1 + 2 x + 4', 'x - 1 - 2 x - 4', 'x - 1 - 4', 'x - 1 + 2 x - 4', 'x - 1 + 4 x - 4', 'x - 1 - 4 x - 2', 'x - 1 - 2', 'x - 1 + 4 x - 2', 'x - 1 - 4 x', 'x - 1 - 2 x', 'x - 1 + 2 x', 'x - 1 + 4 x', 'x - 1 - 4 x + 2', 'x - 1 - 2 x + 2', 'x - 1 + 2', 'x - 1 + 4 x + 2', 'x - 1 - 4 x + 4', 'x - 1 - 2 x + 4', 'x - 1 + 4', 'x - 1 + 2 x + 4', '2 x - 1 - 2 x - 4', '2 x - 1 - 4', '2 x - 1 + 2 x - 4', '2 x - 1 + 4 x - 4', '2 x - 1 - 4 x - 2', '2 x - 1 - 2', '2 x - 1 + 2 x - 2', '2 x - 1 - 4 x', '2 x - 1 - 2 x', '2 x - 1 + 2 x', '2 x - 1 + 4 x', '2 x - 1 - 4 x + 2', '2 x - 1 - 2 x + 2', '2 x - 1 + 2', '2 x - 1 + 4 x + 2', '2 x - 1 - 4 x + 4', '2 x - 1 - 2 x + 4', '2 x - 1 + 4', '2 x - 1 + 2 x + 4', '- 2 x - 2 x - 4', '- 2 x - 4', '- 2 x + 2 x - 4', '- 2 x + 4 x - 4', '- 2 x - 4 x - 2', '- 2 x - 2', '- 2 x + 2 x - 2', '- 2 x + 4 x - 2', '- 2 x - 2 x', '- 2 x + 2 x', '- 2 x + 4 x', '- 2 x - 4 x + 2', '- 2 x - 2 x + 2', '- 2 x + 2', '- 2 x + 4 x + 2', '- 2 x - 4 x + 4', '- 2 x - 2 x + 4', '- 2 x + 4', '- 2 x + 2 x + 4', '- x - 2 x - 4', '- x - 4', '- x + 2 x - 4', '- x + 4 x - 4', '- x - 4 x - 2', '- x - 2', '- x + 2 x - 2', '- x + 4 x - 2', '- x - 4 x', '- x + 2 x', '- x + 4 x', '- x - 4 x + 2', '- x - 2 x + 2', '- x + 2', '- x + 4 x + 2', '- x - 4 x + 4', '- x - 2 x + 4', '- x + 4', '- x + 2 x + 4', 'x - 2 x - 4', 'x - 4', 'x + 2 x - 4', 'x + 4 x - 4', 'x - 4 x - 2', 'x - 2', 'x + 2 x - 2', 'x + 4 x - 2', 'x - 4 x', 'x - 2 x', 'x + 4 x', 'x - 4 x + 2', 'x - 2 x + 2', 'x + 2', 'x + 4 x + 2', 'x - 4 x + 4', 'x - 2 x + 4', 'x + 4', 'x + 2 x + 4', '2 x - 2 x - 4', '2 x - 4', '2 x + 2 x - 4', '2 x + 4 x - 4', '2 x - 4 x - 2', '2 x - 2', '2 x + 2 x - 2', '2 x + 4 x - 2', '2 x - 4 x', '2 x - 2 x', '2 x + 2 x', '2 x - 4 x + 2', '2 x - 2 x + 2', '2 x + 2', '2 x + 4 x + 2', '2 x - 4 x + 4', '2 x - 2 x + 4', '2 x + 4', '2 x + 2 x + 4', '- 2 x + 1 - 2 x - 4', '- 2 x + 1 - 4', '- 2 x + 1 + 2 x - 4', '- 2 x + 1 + 4 x - 4', '- 2 x + 1 - 4 x - 2', '- 2 x + 1 - 2', '- 2 x + 1 + 2 x - 2', '- 2 x + 1 + 4 x - 2', '- 2 x + 1 - 4 x', '- 2 x + 1 - 2 x', '- 2 x + 1 + 2 x', '- 2 x + 1 + 4 x', '- 2 x + 1 - 2 x + 2', '- 2 x + 1 + 2', '- 2 x + 1 + 4 x + 2', '- 2 x + 1 - 4 x + 4', '- 2 x + 1 - 2 x + 4', '- 2 x + 1 + 4', '- 2 x + 1 + 2 x + 4', '- x + 1 - 2 x - 4', '- x + 1 - 4', '- x + 1 + 2 x - 4', '- x + 1 + 4 x - 4', '- x + 1 - 4 x - 2', '- x + 1 - 2', '- x + 1 + 2 x - 2', '- x + 1 + 4 x - 2', '- x + 1 - 4 x', '- x + 1 - 2 x', '- x + 1 + 2 x', '- x + 1 + 4 x', '- x + 1 - 4 x + 2', '- x + 1 + 2', '- x + 1 + 4 x + 2', '- x + 1 - 4 x + 4', '- x + 1 - 2 x + 4', '- x + 1 + 4', '- x + 1 + 2 x + 4', '1 - 2 x - 4', '1 - 4', '1 + 2 x - 4', '1 + 4 x - 4', '1 - 4 x - 2', '1 - 2', '1 + 2 x - 2', '1 + 4 x - 2', '1 - 4 x', '1 - 2 x', '1 + 2 x', '1 + 4 x', '1 - 4 x + 2', '1 - 2 x + 2', '1 + 4 x + 2', '1 - 4 x + 4', '1 - 2 x + 4', '1 + 4', '1 + 2 x + 4', '2 x + 1 - 2 x - 4', '2 x + 1 - 4', '2 x + 1 + 2 x - 4', '2 x + 1 + 4 x - 4', '2 x + 1 - 4 x - 2', '2 x + 1 - 2', '2 x + 1 + 2 x - 2', '2 x + 1 + 4 x - 2', '2 x + 1 - 4 x', '2 x + 1 - 2 x', '2 x + 1 + 2 x', '2 x + 1 + 4 x', '2 x + 1 - 4 x + 2', '2 x + 1 - 2 x + 2', '2 x + 1 + 2', '2 x + 1 - 4 x + 4', '2 x + 1 - 2 x + 4', '2 x + 1 + 4', '2 x + 1 + 2 x + 4', '- 2 x + 2 - 2 x - 4', '- 2 x + 2 - 4', '- 2 x + 2 + 2 x - 4', '- 2 x + 2 + 4 x - 4', '- 2 x + 2 - 4 x - 2', '- 2 x + 2 - 2', '- 2 x + 2 + 2 x - 2', '- 2 x + 2 + 4 x - 2', '- 2 x + 2 - 4 x', '- 2 x + 2 - 2 x', '- 2 x + 2 + 2 x', '- 2 x + 2 + 4 x', '- 2 x + 2 - 4 x + 2', '- 2 x + 2 - 2 x + 2', '- 2 x + 2 + 2', '- 2 x + 2 + 4 x + 2', '- 2 x + 2 - 2 x + 4', '- 2 x + 2 + 4', '- 2 x + 2 + 2 x + 4', '- x + 2 - 2 x - 4', '- x + 2 - 4', '- x + 2 + 2 x - 4', '- x + 2 + 4 x - 4', '- x + 2 - 4 x - 2', '- x + 2 - 2', '- x + 2 + 2 x - 2', '- x + 2 + 4 x - 2', '- x + 2 - 4 x', '- x + 2 - 2 x', '- x + 2 + 2 x', '- x + 2 + 4 x', '- x + 2 - 4 x + 2', '- x + 2 - 2 x + 2', '- x + 2 + 2', '- x + 2 + 4 x + 2', '- x + 2 - 4 x + 4', '- x + 2 + 4', '- x + 2 + 2 x + 4', '2 - 2 x - 4', '2 - 4', '2 + 2 x - 4', '2 + 4 x - 4', '2 - 4 x - 2', '2 - 2', '2 + 2 x - 2', '2 + 4 x - 2', '2 - 4 x', '2 - 2 x', '2 + 2 x', '2 + 4 x', '2 - 4 x + 2', '2 - 2 x + 2', '2 + 2', '2 + 4 x + 2', '2 - 4 x + 4', '2 - 2 x + 4', '2 + 2 x + 4', 'x + 2 - 2 x - 4', 'x + 2 - 4', 'x + 2 + 2 x - 4', 'x + 2 + 4 x - 4', 'x + 2 - 4 x - 2', 'x + 2 - 2', 'x + 2 + 2 x - 2', 'x + 2 + 4 x - 2', 'x + 2 - 4 x', 'x + 2 - 2 x', 'x + 2 + 2 x', 'x + 2 + 4 x', 'x + 2 - 4 x + 2', 'x + 2 - 2 x + 2', 'x + 2 + 2', 'x + 2 + 4 x + 2', 'x + 2 - 4 x + 4', 'x + 2 - 2 x + 4', 'x + 2 + 4'] -POLY_SUB_VALID_RESULTS = ['- x - 2 - ( - 4 )', '- x - 2 - ( 2 x - 4 )', '- x - 2 - ( 4 x - 4 )', '- x - 2 - ( - 4 x - 2 )', '- x - 2 - ( - 2 )', '- x - 2 - ( 2 x - 2 )', '- x - 2 - ( 4 x - 2 )', '- x - 2 - ( - 4 x )', '- x - 2 - ( - 2 x )', '- x - 2 - 2 x', '- x - 2 - 4 x', '- x - 2 - ( - 4 x + 2 )', '- x - 2 - ( - 2 x + 2 )', '- x - 2 - 2', '- x - 2 - ( 4 x + 2 )', '- x - 2 - ( - 4 x + 4 )', '- x - 2 - ( - 2 x + 4 )', '- x - 2 - 4', '- x - 2 - ( 2 x + 4 )', '- 2 - ( - 2 x - 4 )', '- 2 - ( 2 x - 4 )', '- 2 - ( 4 x - 4 )', '- 2 - ( - 4 x - 2 )', '- 2 - ( - 2 )', '- 2 - ( 2 x - 2 )', '- 2 - ( 4 x - 2 )', '- 2 - ( - 4 x )', '- 2 - ( - 2 x )', '- 2 - 2 x', '- 2 - 4 x', '- 2 - ( - 4 x + 2 )', '- 2 - ( - 2 x + 2 )', '- 2 - 2', '- 2 - ( 4 x + 2 )', '- 2 - ( - 4 x + 4 )', '- 2 - ( - 2 x + 4 )', '- 2 - 4', '- 2 - ( 2 x + 4 )', 'x - 2 - ( - 2 x - 4 )', 'x - 2 - ( - 4 )', 'x - 2 - ( 4 x - 4 )', 'x - 2 - ( - 4 x - 2 )', 'x - 2 - ( - 2 )', 'x - 2 - ( 2 x - 2 )', 'x - 2 - ( 4 x - 2 )', 'x - 2 - ( - 4 x )', 'x - 2 - ( - 2 x )', 'x - 2 - 2 x', 'x - 2 - 4 x', 'x - 2 - ( - 4 x + 2 )', 'x - 2 - ( - 2 x + 2 )', 'x - 2 - 2', 'x - 2 - ( 4 x + 2 )', 'x - 2 - ( - 4 x + 4 )', 'x - 2 - ( - 2 x + 4 )', 'x - 2 - 4', 'x - 2 - ( 2 x + 4 )', '2 x - 2 - ( - 2 x - 4 )', '2 x - 2 - ( - 4 )', '2 x - 2 - ( 2 x - 4 )', '2 x - 2 - ( - 4 x - 2 )', '2 x - 2 - ( - 2 )', '2 x - 2 - ( 2 x - 2 )', '2 x - 2 - ( 4 x - 2 )', '2 x - 2 - ( - 4 x )', '2 x - 2 - ( - 2 x )', '2 x - 2 - 2 x', '2 x - 2 - 4 x', '2 x - 2 - ( - 4 x + 2 )', '2 x - 2 - ( - 2 x + 2 )', '2 x - 2 - 2', '2 x - 2 - ( 4 x + 2 )', '2 x - 2 - ( - 4 x + 4 )', '2 x - 2 - ( - 2 x + 4 )', '2 x - 2 - 4', '2 x - 2 - ( 2 x + 4 )', '- 2 x - 1 - ( - 2 x - 4 )', '- 2 x - 1 - ( - 4 )', '- 2 x - 1 - ( 2 x - 4 )', '- 2 x - 1 - ( 4 x - 4 )', '- 2 x - 1 - ( - 2 )', '- 2 x - 1 - ( 2 x - 2 )', '- 2 x - 1 - ( 4 x - 2 )', '- 2 x - 1 - ( - 4 x )', '- 2 x - 1 - ( - 2 x )', '- 2 x - 1 - 2 x', '- 2 x - 1 - 4 x', '- 2 x - 1 - ( - 4 x + 2 )', '- 2 x - 1 - ( - 2 x + 2 )', '- 2 x - 1 - 2', '- 2 x - 1 - ( 4 x + 2 )', '- 2 x - 1 - ( - 4 x + 4 )', '- 2 x - 1 - ( - 2 x + 4 )', '- 2 x - 1 - 4', '- 2 x - 1 - ( 2 x + 4 )', '- 1 - ( - 2 x - 4 )', '- 1 - ( - 4 )', '- 1 - ( 2 x - 4 )', '- 1 - ( 4 x - 4 )', '- 1 - ( - 4 x - 2 )', '- 1 - ( 2 x - 2 )', '- 1 - ( 4 x - 2 )', '- 1 - ( - 4 x )', '- 1 - ( - 2 x )', '- 1 - 2 x', '- 1 - 4 x', '- 1 - ( - 4 x + 2 )', '- 1 - ( - 2 x + 2 )', '- 1 - 2', '- 1 - ( 4 x + 2 )', '- 1 - ( - 4 x + 4 )', '- 1 - ( - 2 x + 4 )', '- 1 - 4', '- 1 - ( 2 x + 4 )', 'x - 1 - ( - 2 x - 4 )', 'x - 1 - ( - 4 )', 'x - 1 - ( 2 x - 4 )', 'x - 1 - ( 4 x - 4 )', 'x - 1 - ( - 4 x - 2 )', 'x - 1 - ( - 2 )', 'x - 1 - ( 4 x - 2 )', 'x - 1 - ( - 4 x )', 'x - 1 - ( - 2 x )', 'x - 1 - 2 x', 'x - 1 - 4 x', 'x - 1 - ( - 4 x + 2 )', 'x - 1 - ( - 2 x + 2 )', 'x - 1 - 2', 'x - 1 - ( 4 x + 2 )', 'x - 1 - ( - 4 x + 4 )', 'x - 1 - ( - 2 x + 4 )', 'x - 1 - 4', 'x - 1 - ( 2 x + 4 )', '2 x - 1 - ( - 2 x - 4 )', '2 x - 1 - ( - 4 )', '2 x - 1 - ( 2 x - 4 )', '2 x - 1 - ( 4 x - 4 )', '2 x - 1 - ( - 4 x - 2 )', '2 x - 1 - ( - 2 )', '2 x - 1 - ( 2 x - 2 )', '2 x - 1 - ( - 4 x )', '2 x - 1 - ( - 2 x )', '2 x - 1 - 2 x', '2 x - 1 - 4 x', '2 x - 1 - ( - 4 x + 2 )', '2 x - 1 - ( - 2 x + 2 )', '2 x - 1 - 2', '2 x - 1 - ( 4 x + 2 )', '2 x - 1 - ( - 4 x + 4 )', '2 x - 1 - ( - 2 x + 4 )', '2 x - 1 - 4', '2 x - 1 - ( 2 x + 4 )', '- 2 x - ( - 2 x - 4 )', '- 2 x - ( - 4 )', '- 2 x - ( 2 x - 4 )', '- 2 x - ( 4 x - 4 )', '- 2 x - ( - 4 x - 2 )', '- 2 x - ( - 2 )', '- 2 x - ( 2 x - 2 )', '- 2 x - ( 4 x - 2 )', '- 2 x - ( - 2 x )', '- 2 x - 2 x', '- 2 x - 4 x', '- 2 x - ( - 4 x + 2 )', '- 2 x - ( - 2 x + 2 )', '- 2 x - 2', '- 2 x - ( 4 x + 2 )', '- 2 x - ( - 4 x + 4 )', '- 2 x - ( - 2 x + 4 )', '- 2 x - 4', '- 2 x - ( 2 x + 4 )', '- x - ( - 2 x - 4 )', '- x - ( - 4 )', '- x - ( 2 x - 4 )', '- x - ( 4 x - 4 )', '- x - ( - 4 x - 2 )', '- x - ( - 2 )', '- x - ( 2 x - 2 )', '- x - ( 4 x - 2 )', '- x - ( - 4 x )', '- x - 2 x', '- x - 4 x', '- x - ( - 4 x + 2 )', '- x - ( - 2 x + 2 )', '- x - 2', '- x - ( 4 x + 2 )', '- x - ( - 4 x + 4 )', '- x - ( - 2 x + 4 )', '- x - 4', '- x - ( 2 x + 4 )', 'x - ( - 2 x - 4 )', 'x - ( - 4 )', 'x - ( 2 x - 4 )', 'x - ( 4 x - 4 )', 'x - ( - 4 x - 2 )', 'x - ( - 2 )', 'x - ( 2 x - 2 )', 'x - ( 4 x - 2 )', 'x - ( - 4 x )', 'x - ( - 2 x )', 'x - 4 x', 'x - ( - 4 x + 2 )', 'x - ( - 2 x + 2 )', 'x - 2', 'x - ( 4 x + 2 )', 'x - ( - 4 x + 4 )', 'x - ( - 2 x + 4 )', 'x - 4', 'x - ( 2 x + 4 )', '2 x - ( - 2 x - 4 )', '2 x - ( - 4 )', '2 x - ( 2 x - 4 )', '2 x - ( 4 x - 4 )', '2 x - ( - 4 x - 2 )', '2 x - ( - 2 )', '2 x - ( 2 x - 2 )', '2 x - ( 4 x - 2 )', '2 x - ( - 4 x )', '2 x - ( - 2 x )', '2 x - 2 x', '2 x - ( - 4 x + 2 )', '2 x - ( - 2 x + 2 )', '2 x - 2', '2 x - ( 4 x + 2 )', '2 x - ( - 4 x + 4 )', '2 x - ( - 2 x + 4 )', '2 x - 4', '2 x - ( 2 x + 4 )', '- 2 x + 1 - ( - 2 x - 4 )', '- 2 x + 1 - ( - 4 )', '- 2 x + 1 - ( 2 x - 4 )', '- 2 x + 1 - ( 4 x - 4 )', '- 2 x + 1 - ( - 4 x - 2 )', '- 2 x + 1 - ( - 2 )', '- 2 x + 1 - ( 2 x - 2 )', '- 2 x + 1 - ( 4 x - 2 )', '- 2 x + 1 - ( - 4 x )', '- 2 x + 1 - ( - 2 x )', '- 2 x + 1 - 2 x', '- 2 x + 1 - 4 x', '- 2 x + 1 - ( - 2 x + 2 )', '- 2 x + 1 - 2', '- 2 x + 1 - ( 4 x + 2 )', '- 2 x + 1 - ( - 4 x + 4 )', '- 2 x + 1 - ( - 2 x + 4 )', '- 2 x + 1 - 4', '- 2 x + 1 - ( 2 x + 4 )', '- x + 1 - ( - 2 x - 4 )', '- x + 1 - ( - 4 )', '- x + 1 - ( 2 x - 4 )', '- x + 1 - ( 4 x - 4 )', '- x + 1 - ( - 4 x - 2 )', '- x + 1 - ( - 2 )', '- x + 1 - ( 2 x - 2 )', '- x + 1 - ( 4 x - 2 )', '- x + 1 - ( - 4 x )', '- x + 1 - ( - 2 x )', '- x + 1 - 2 x', '- x + 1 - 4 x', '- x + 1 - ( - 4 x + 2 )', '- x + 1 - 2', '- x + 1 - ( 4 x + 2 )', '- x + 1 - ( - 4 x + 4 )', '- x + 1 - ( - 2 x + 4 )', '- x + 1 - 4', '- x + 1 - ( 2 x + 4 )', '1 - ( - 2 x - 4 )', '1 - ( - 4 )', '1 - ( 2 x - 4 )', '1 - ( 4 x - 4 )', '1 - ( - 4 x - 2 )', '1 - ( - 2 )', '1 - ( 2 x - 2 )', '1 - ( 4 x - 2 )', '1 - ( - 4 x )', '1 - ( - 2 x )', '1 - 2 x', '1 - 4 x', '1 - ( - 4 x + 2 )', '1 - ( - 2 x + 2 )', '1 - ( 4 x + 2 )', '1 - ( - 4 x + 4 )', '1 - ( - 2 x + 4 )', '1 - 4', '1 - ( 2 x + 4 )', '2 x + 1 - ( - 2 x - 4 )', '2 x + 1 - ( - 4 )', '2 x + 1 - ( 2 x - 4 )', '2 x + 1 - ( 4 x - 4 )', '2 x + 1 - ( - 4 x - 2 )', '2 x + 1 - ( - 2 )', '2 x + 1 - ( 2 x - 2 )', '2 x + 1 - ( 4 x - 2 )', '2 x + 1 - ( - 4 x )', '2 x + 1 - ( - 2 x )', '2 x + 1 - 2 x', '2 x + 1 - 4 x', '2 x + 1 - ( - 4 x + 2 )', '2 x + 1 - ( - 2 x + 2 )', '2 x + 1 - 2', '2 x + 1 - ( - 4 x + 4 )', '2 x + 1 - ( - 2 x + 4 )', '2 x + 1 - 4', '2 x + 1 - ( 2 x + 4 )', '- 2 x + 2 - ( - 2 x - 4 )', '- 2 x + 2 - ( - 4 )', '- 2 x + 2 - ( 2 x - 4 )', '- 2 x + 2 - ( 4 x - 4 )', '- 2 x + 2 - ( - 4 x - 2 )', '- 2 x + 2 - ( - 2 )', '- 2 x + 2 - ( 2 x - 2 )', '- 2 x + 2 - ( 4 x - 2 )', '- 2 x + 2 - ( - 4 x )', '- 2 x + 2 - ( - 2 x )', '- 2 x + 2 - 2 x', '- 2 x + 2 - 4 x', '- 2 x + 2 - ( - 4 x + 2 )', '- 2 x + 2 - ( - 2 x + 2 )', '- 2 x + 2 - 2', '- 2 x + 2 - ( 4 x + 2 )', '- 2 x + 2 - ( - 2 x + 4 )', '- 2 x + 2 - 4', '- 2 x + 2 - ( 2 x + 4 )', '- x + 2 - ( - 2 x - 4 )', '- x + 2 - ( - 4 )', '- x + 2 - ( 2 x - 4 )', '- x + 2 - ( 4 x - 4 )', '- x + 2 - ( - 4 x - 2 )', '- x + 2 - ( - 2 )', '- x + 2 - ( 2 x - 2 )', '- x + 2 - ( 4 x - 2 )', '- x + 2 - ( - 4 x )', '- x + 2 - ( - 2 x )', '- x + 2 - 2 x', '- x + 2 - 4 x', '- x + 2 - ( - 4 x + 2 )', '- x + 2 - ( - 2 x + 2 )', '- x + 2 - 2', '- x + 2 - ( 4 x + 2 )', '- x + 2 - ( - 4 x + 4 )', '- x + 2 - 4', '- x + 2 - ( 2 x + 4 )', '2 - ( - 2 x - 4 )', '2 - ( - 4 )', '2 - ( 2 x - 4 )', '2 - ( 4 x - 4 )', '2 - ( - 4 x - 2 )', '2 - ( - 2 )', '2 - ( 2 x - 2 )', '2 - ( 4 x - 2 )', '2 - ( - 4 x )', '2 - ( - 2 x )', '2 - 2 x', '2 - 4 x', '2 - ( - 4 x + 2 )', '2 - ( - 2 x + 2 )', '2 - 2', '2 - ( 4 x + 2 )', '2 - ( - 4 x + 4 )', '2 - ( - 2 x + 4 )', '2 - ( 2 x + 4 )', 'x + 2 - ( - 2 x - 4 )', 'x + 2 - ( - 4 )', 'x + 2 - ( 2 x - 4 )', 'x + 2 - ( 4 x - 4 )', 'x + 2 - ( - 4 x - 2 )', 'x + 2 - ( - 2 )', 'x + 2 - ( 2 x - 2 )', 'x + 2 - ( 4 x - 2 )', 'x + 2 - ( - 4 x )', 'x + 2 - ( - 2 x )', 'x + 2 - 2 x', 'x + 2 - 4 x', 'x + 2 - ( - 4 x + 2 )', 'x + 2 - ( - 2 x + 2 )', 'x + 2 - 2', 'x + 2 - ( 4 x + 2 )', 'x + 2 - ( - 4 x + 4 )', 'x + 2 - ( - 2 x + 4 )', 'x + 2 - 4'] -TEX_POLY_MUL_VALID_RESULTS = ['( - x - 2 ) \\times ( - 4 )', '( - x - 2 ) ( 2 x - 4 )', '( - x - 2 ) ( 4 x - 4 )', '( - x - 2 ) ( - 4 x - 2 )', '( - x - 2 ) \\times ( - 2 )', '( - x - 2 ) ( 2 x - 2 )', '( - x - 2 ) ( 4 x - 2 )', '( - x - 2 ) \\times ( - 4 x )', '( - x - 2 ) \\times ( - 2 x )', '( - x - 2 ) \\times 2 x', '( - x - 2 ) \\times 4 x', '( - x - 2 ) ( - 4 x + 2 )', '( - x - 2 ) ( - 2 x + 2 )', '( - x - 2 ) \\times 2', '( - x - 2 ) ( 4 x + 2 )', '( - x - 2 ) ( - 4 x + 4 )', '( - x - 2 ) ( - 2 x + 4 )', '( - x - 2 ) \\times 4', '( - x - 2 ) ( 2 x + 4 )', '- 2 ( - 2 x - 4 )', '- 2 ( 2 x - 4 )', '- 2 ( 4 x - 4 )', '- 2 ( - 4 x - 2 )', '- 2 \\times ( - 2 )', '- 2 ( 2 x - 2 )', '- 2 ( 4 x - 2 )', '- 2 \\times ( - 4 x )', '- 2 \\times ( - 2 x )', '- 2 \\times 2 x', '- 2 \\times 4 x', '- 2 ( - 4 x + 2 )', '- 2 ( - 2 x + 2 )', '- 2 \\times 2', '- 2 ( 4 x + 2 )', '- 2 ( - 4 x + 4 )', '- 2 ( - 2 x + 4 )', '- 2 \\times 4', '- 2 ( 2 x + 4 )', '( x - 2 ) ( - 2 x - 4 )', '( x - 2 ) \\times ( - 4 )', '( x - 2 ) ( 4 x - 4 )', '( x - 2 ) ( - 4 x - 2 )', '( x - 2 ) \\times ( - 2 )', '( x - 2 ) ( 2 x - 2 )', '( x - 2 ) ( 4 x - 2 )', '( x - 2 ) \\times ( - 4 x )', '( x - 2 ) \\times ( - 2 x )', '( x - 2 ) \\times 2 x', '( x - 2 ) \\times 4 x', '( x - 2 ) ( - 4 x + 2 )', '( x - 2 ) ( - 2 x + 2 )', '( x - 2 ) \\times 2', '( x - 2 ) ( 4 x + 2 )', '( x - 2 ) ( - 4 x + 4 )', '( x - 2 ) ( - 2 x + 4 )', '( x - 2 ) \\times 4', '( x - 2 ) ( 2 x + 4 )', '( 2 x - 2 ) ( - 2 x - 4 )', '( 2 x - 2 ) \\times ( - 4 )', '( 2 x - 2 ) ( 2 x - 4 )', '( 2 x - 2 ) ( - 4 x - 2 )', '( 2 x - 2 ) \\times ( - 2 )', '( 2 x - 2 ) ( 2 x - 2 )', '( 2 x - 2 ) ( 4 x - 2 )', '( 2 x - 2 ) \\times ( - 4 x )', '( 2 x - 2 ) \\times ( - 2 x )', '( 2 x - 2 ) \\times 2 x', '( 2 x - 2 ) \\times 4 x', '( 2 x - 2 ) ( - 4 x + 2 )', '( 2 x - 2 ) ( - 2 x + 2 )', '( 2 x - 2 ) \\times 2', '( 2 x - 2 ) ( 4 x + 2 )', '( 2 x - 2 ) ( - 4 x + 4 )', '( 2 x - 2 ) ( - 2 x + 4 )', '( 2 x - 2 ) \\times 4', '( 2 x - 2 ) ( 2 x + 4 )', '( - 2 x - 1 ) ( - 2 x - 4 )', '( - 2 x - 1 ) \\times ( - 4 )', '( - 2 x - 1 ) ( 2 x - 4 )', '( - 2 x - 1 ) ( 4 x - 4 )', '( - 2 x - 1 ) \\times ( - 2 )', '( - 2 x - 1 ) ( 2 x - 2 )', '( - 2 x - 1 ) ( 4 x - 2 )', '( - 2 x - 1 ) \\times ( - 4 x )', '( - 2 x - 1 ) \\times ( - 2 x )', '( - 2 x - 1 ) \\times 2 x', '( - 2 x - 1 ) \\times 4 x', '( - 2 x - 1 ) ( - 4 x + 2 )', '( - 2 x - 1 ) ( - 2 x + 2 )', '( - 2 x - 1 ) \\times 2', '( - 2 x - 1 ) ( 4 x + 2 )', '( - 2 x - 1 ) ( - 4 x + 4 )', '( - 2 x - 1 ) ( - 2 x + 4 )', '( - 2 x - 1 ) \\times 4', '( - 2 x - 1 ) ( 2 x + 4 )', '- 1 ( - 2 x - 4 )', '- 1 \\times ( - 4 )', '- 1 ( 2 x - 4 )', '- 1 ( 4 x - 4 )', '- 1 ( - 4 x - 2 )', '- 1 ( 2 x - 2 )', '- 1 ( 4 x - 2 )', '- 1 \\times ( - 4 x )', '- 1 \\times ( - 2 x )', '- 1 \\times 2 x', '- 1 \\times 4 x', '- 1 ( - 4 x + 2 )', '- 1 ( - 2 x + 2 )', '- 1 \\times 2', '- 1 ( 4 x + 2 )', '- 1 ( - 4 x + 4 )', '- 1 ( - 2 x + 4 )', '- 1 \\times 4', '- 1 ( 2 x + 4 )', '( x - 1 ) ( - 2 x - 4 )', '( x - 1 ) \\times ( - 4 )', '( x - 1 ) ( 2 x - 4 )', '( x - 1 ) ( 4 x - 4 )', '( x - 1 ) ( - 4 x - 2 )', '( x - 1 ) \\times ( - 2 )', '( x - 1 ) ( 4 x - 2 )', '( x - 1 ) \\times ( - 4 x )', '( x - 1 ) \\times ( - 2 x )', '( x - 1 ) \\times 2 x', '( x - 1 ) \\times 4 x', '( x - 1 ) ( - 4 x + 2 )', '( x - 1 ) ( - 2 x + 2 )', '( x - 1 ) \\times 2', '( x - 1 ) ( 4 x + 2 )', '( x - 1 ) ( - 4 x + 4 )', '( x - 1 ) ( - 2 x + 4 )', '( x - 1 ) \\times 4', '( x - 1 ) ( 2 x + 4 )', '( 2 x - 1 ) ( - 2 x - 4 )', '( 2 x - 1 ) \\times ( - 4 )', '( 2 x - 1 ) ( 2 x - 4 )', '( 2 x - 1 ) ( 4 x - 4 )', '( 2 x - 1 ) ( - 4 x - 2 )', '( 2 x - 1 ) \\times ( - 2 )', '( 2 x - 1 ) ( 2 x - 2 )', '( 2 x - 1 ) \\times ( - 4 x )', '( 2 x - 1 ) \\times ( - 2 x )', '( 2 x - 1 ) \\times 2 x', '( 2 x - 1 ) \\times 4 x', '( 2 x - 1 ) ( - 4 x + 2 )', '( 2 x - 1 ) ( - 2 x + 2 )', '( 2 x - 1 ) \\times 2', '( 2 x - 1 ) ( 4 x + 2 )', '( 2 x - 1 ) ( - 4 x + 4 )', '( 2 x - 1 ) ( - 2 x + 4 )', '( 2 x - 1 ) \\times 4', '( 2 x - 1 ) ( 2 x + 4 )', '- 2 x ( - 2 x - 4 )', '- 2 x \\times ( - 4 )', '- 2 x ( 2 x - 4 )', '- 2 x ( 4 x - 4 )', '- 2 x ( - 4 x - 2 )', '- 2 x \\times ( - 2 )', '- 2 x ( 2 x - 2 )', '- 2 x ( 4 x - 2 )', '- 2 x \\times ( - 2 x )', '- 2 x \\times 2 x', '- 2 x \\times 4 x', '- 2 x ( - 4 x + 2 )', '- 2 x ( - 2 x + 2 )', '- 2 x \\times 2', '- 2 x ( 4 x + 2 )', '- 2 x ( - 4 x + 4 )', '- 2 x ( - 2 x + 4 )', '- 2 x \\times 4', '- 2 x ( 2 x + 4 )', '- x ( - 2 x - 4 )', '- x \\times ( - 4 )', '- x ( 2 x - 4 )', '- x ( 4 x - 4 )', '- x ( - 4 x - 2 )', '- x \\times ( - 2 )', '- x ( 2 x - 2 )', '- x ( 4 x - 2 )', '- x \\times ( - 4 x )', '- x \\times 2 x', '- x \\times 4 x', '- x ( - 4 x + 2 )', '- x ( - 2 x + 2 )', '- x \\times 2', '- x ( 4 x + 2 )', '- x ( - 4 x + 4 )', '- x ( - 2 x + 4 )', '- x \\times 4', '- x ( 2 x + 4 )', 'x ( - 2 x - 4 )', 'x \\times ( - 4 )', 'x ( 2 x - 4 )', 'x ( 4 x - 4 )', 'x ( - 4 x - 2 )', 'x \\times ( - 2 )', 'x ( 2 x - 2 )', 'x ( 4 x - 2 )', 'x \\times ( - 4 x )', 'x \\times ( - 2 x )', 'x \\times 4 x', 'x ( - 4 x + 2 )', 'x ( - 2 x + 2 )', 'x \\times 2', 'x ( 4 x + 2 )', 'x ( - 4 x + 4 )', 'x ( - 2 x + 4 )', 'x \\times 4', 'x ( 2 x + 4 )', '2 x ( - 2 x - 4 )', '2 x \\times ( - 4 )', '2 x ( 2 x - 4 )', '2 x ( 4 x - 4 )', '2 x ( - 4 x - 2 )', '2 x \\times ( - 2 )', '2 x ( 2 x - 2 )', '2 x ( 4 x - 2 )', '2 x \\times ( - 4 x )', '2 x \\times ( - 2 x )', '2 x \\times 2 x', '2 x ( - 4 x + 2 )', '2 x ( - 2 x + 2 )', '2 x \\times 2', '2 x ( 4 x + 2 )', '2 x ( - 4 x + 4 )', '2 x ( - 2 x + 4 )', '2 x \\times 4', '2 x ( 2 x + 4 )', '( - 2 x + 1 ) ( - 2 x - 4 )', '( - 2 x + 1 ) \\times ( - 4 )', '( - 2 x + 1 ) ( 2 x - 4 )', '( - 2 x + 1 ) ( 4 x - 4 )', '( - 2 x + 1 ) ( - 4 x - 2 )', '( - 2 x + 1 ) \\times ( - 2 )', '( - 2 x + 1 ) ( 2 x - 2 )', '( - 2 x + 1 ) ( 4 x - 2 )', '( - 2 x + 1 ) \\times ( - 4 x )', '( - 2 x + 1 ) \\times ( - 2 x )', '( - 2 x + 1 ) \\times 2 x', '( - 2 x + 1 ) \\times 4 x', '( - 2 x + 1 ) ( - 2 x + 2 )', '( - 2 x + 1 ) \\times 2', '( - 2 x + 1 ) ( 4 x + 2 )', '( - 2 x + 1 ) ( - 4 x + 4 )', '( - 2 x + 1 ) ( - 2 x + 4 )', '( - 2 x + 1 ) \\times 4', '( - 2 x + 1 ) ( 2 x + 4 )', '( - x + 1 ) ( - 2 x - 4 )', '( - x + 1 ) \\times ( - 4 )', '( - x + 1 ) ( 2 x - 4 )', '( - x + 1 ) ( 4 x - 4 )', '( - x + 1 ) ( - 4 x - 2 )', '( - x + 1 ) \\times ( - 2 )', '( - x + 1 ) ( 2 x - 2 )', '( - x + 1 ) ( 4 x - 2 )', '( - x + 1 ) \\times ( - 4 x )', '( - x + 1 ) \\times ( - 2 x )', '( - x + 1 ) \\times 2 x', '( - x + 1 ) \\times 4 x', '( - x + 1 ) ( - 4 x + 2 )', '( - x + 1 ) \\times 2', '( - x + 1 ) ( 4 x + 2 )', '( - x + 1 ) ( - 4 x + 4 )', '( - x + 1 ) ( - 2 x + 4 )', '( - x + 1 ) \\times 4', '( - x + 1 ) ( 2 x + 4 )', '1 ( - 2 x - 4 )', '1 \\times ( - 4 )', '1 ( 2 x - 4 )', '1 ( 4 x - 4 )', '1 ( - 4 x - 2 )', '1 \\times ( - 2 )', '1 ( 2 x - 2 )', '1 ( 4 x - 2 )', '1 \\times ( - 4 x )', '1 \\times ( - 2 x )', '1 \\times 2 x', '1 \\times 4 x', '1 ( - 4 x + 2 )', '1 ( - 2 x + 2 )', '1 ( 4 x + 2 )', '1 ( - 4 x + 4 )', '1 ( - 2 x + 4 )', '1 \\times 4', '1 ( 2 x + 4 )', '( 2 x + 1 ) ( - 2 x - 4 )', '( 2 x + 1 ) \\times ( - 4 )', '( 2 x + 1 ) ( 2 x - 4 )', '( 2 x + 1 ) ( 4 x - 4 )', '( 2 x + 1 ) ( - 4 x - 2 )', '( 2 x + 1 ) \\times ( - 2 )', '( 2 x + 1 ) ( 2 x - 2 )', '( 2 x + 1 ) ( 4 x - 2 )', '( 2 x + 1 ) \\times ( - 4 x )', '( 2 x + 1 ) \\times ( - 2 x )', '( 2 x + 1 ) \\times 2 x', '( 2 x + 1 ) \\times 4 x', '( 2 x + 1 ) ( - 4 x + 2 )', '( 2 x + 1 ) ( - 2 x + 2 )', '( 2 x + 1 ) \\times 2', '( 2 x + 1 ) ( - 4 x + 4 )', '( 2 x + 1 ) ( - 2 x + 4 )', '( 2 x + 1 ) \\times 4', '( 2 x + 1 ) ( 2 x + 4 )', '( - 2 x + 2 ) ( - 2 x - 4 )', '( - 2 x + 2 ) \\times ( - 4 )', '( - 2 x + 2 ) ( 2 x - 4 )', '( - 2 x + 2 ) ( 4 x - 4 )', '( - 2 x + 2 ) ( - 4 x - 2 )', '( - 2 x + 2 ) \\times ( - 2 )', '( - 2 x + 2 ) ( 2 x - 2 )', '( - 2 x + 2 ) ( 4 x - 2 )', '( - 2 x + 2 ) \\times ( - 4 x )', '( - 2 x + 2 ) \\times ( - 2 x )', '( - 2 x + 2 ) \\times 2 x', '( - 2 x + 2 ) \\times 4 x', '( - 2 x + 2 ) ( - 4 x + 2 )', '( - 2 x + 2 ) ( - 2 x + 2 )', '( - 2 x + 2 ) \\times 2', '( - 2 x + 2 ) ( 4 x + 2 )', '( - 2 x + 2 ) ( - 2 x + 4 )', '( - 2 x + 2 ) \\times 4', '( - 2 x + 2 ) ( 2 x + 4 )', '( - x + 2 ) ( - 2 x - 4 )', '( - x + 2 ) \\times ( - 4 )', '( - x + 2 ) ( 2 x - 4 )', '( - x + 2 ) ( 4 x - 4 )', '( - x + 2 ) ( - 4 x - 2 )', '( - x + 2 ) \\times ( - 2 )', '( - x + 2 ) ( 2 x - 2 )', '( - x + 2 ) ( 4 x - 2 )', '( - x + 2 ) \\times ( - 4 x )', '( - x + 2 ) \\times ( - 2 x )', '( - x + 2 ) \\times 2 x', '( - x + 2 ) \\times 4 x', '( - x + 2 ) ( - 4 x + 2 )', '( - x + 2 ) ( - 2 x + 2 )', '( - x + 2 ) \\times 2', '( - x + 2 ) ( 4 x + 2 )', '( - x + 2 ) ( - 4 x + 4 )', '( - x + 2 ) \\times 4', '( - x + 2 ) ( 2 x + 4 )', '2 ( - 2 x - 4 )', '2 \\times ( - 4 )', '2 ( 2 x - 4 )', '2 ( 4 x - 4 )', '2 ( - 4 x - 2 )', '2 \\times ( - 2 )', '2 ( 2 x - 2 )', '2 ( 4 x - 2 )', '2 \\times ( - 4 x )', '2 \\times ( - 2 x )', '2 \\times 2 x', '2 \\times 4 x', '2 ( - 4 x + 2 )', '2 ( - 2 x + 2 )', '2 \\times 2', '2 ( 4 x + 2 )', '2 ( - 4 x + 4 )', '2 ( - 2 x + 4 )', '2 ( 2 x + 4 )', '( x + 2 ) ( - 2 x - 4 )', '( x + 2 ) \\times ( - 4 )', '( x + 2 ) ( 2 x - 4 )', '( x + 2 ) ( 4 x - 4 )', '( x + 2 ) ( - 4 x - 2 )', '( x + 2 ) \\times ( - 2 )', '( x + 2 ) ( 2 x - 2 )', '( x + 2 ) ( 4 x - 2 )', '( x + 2 ) \\times ( - 4 x )', '( x + 2 ) \\times ( - 2 x )', '( x + 2 ) \\times 2 x', '( x + 2 ) \\times 4 x', '( x + 2 ) ( - 4 x + 2 )', '( x + 2 ) ( - 2 x + 2 )', '( x + 2 ) \\times 2', '( x + 2 ) ( 4 x + 2 )', '( x + 2 ) ( - 4 x + 4 )', '( x + 2 ) ( - 2 x + 4 )', '( x + 2 ) \\times 4'] -TXT_POLY_MUL_VALID_RESULTS = ['( - x - 2 ) * ( - 4 )', '( - x - 2 ) ( 2 x - 4 )', '( - x - 2 ) ( 4 x - 4 )', '( - x - 2 ) ( - 4 x - 2 )', '( - x - 2 ) * ( - 2 )', '( - x - 2 ) ( 2 x - 2 )', '( - x - 2 ) ( 4 x - 2 )', '( - x - 2 ) * ( - 4 x )', '( - x - 2 ) * ( - 2 x )', '( - x - 2 ) * 2 x', '( - x - 2 ) * 4 x', '( - x - 2 ) ( - 4 x + 2 )', '( - x - 2 ) ( - 2 x + 2 )', '( - x - 2 ) * 2', '( - x - 2 ) ( 4 x + 2 )', '( - x - 2 ) ( - 4 x + 4 )', '( - x - 2 ) ( - 2 x + 4 )', '( - x - 2 ) * 4', '( - x - 2 ) ( 2 x + 4 )', '- 2 ( - 2 x - 4 )', '- 2 ( 2 x - 4 )', '- 2 ( 4 x - 4 )', '- 2 ( - 4 x - 2 )', '- 2 * ( - 2 )', '- 2 ( 2 x - 2 )', '- 2 ( 4 x - 2 )', '- 2 * ( - 4 x )', '- 2 * ( - 2 x )', '- 2 * 2 x', '- 2 * 4 x', '- 2 ( - 4 x + 2 )', '- 2 ( - 2 x + 2 )', '- 2 * 2', '- 2 ( 4 x + 2 )', '- 2 ( - 4 x + 4 )', '- 2 ( - 2 x + 4 )', '- 2 * 4', '- 2 ( 2 x + 4 )', '( x - 2 ) ( - 2 x - 4 )', '( x - 2 ) * ( - 4 )', '( x - 2 ) ( 4 x - 4 )', '( x - 2 ) ( - 4 x - 2 )', '( x - 2 ) * ( - 2 )', '( x - 2 ) ( 2 x - 2 )', '( x - 2 ) ( 4 x - 2 )', '( x - 2 ) * ( - 4 x )', '( x - 2 ) * ( - 2 x )', '( x - 2 ) * 2 x', '( x - 2 ) * 4 x', '( x - 2 ) ( - 4 x + 2 )', '( x - 2 ) ( - 2 x + 2 )', '( x - 2 ) * 2', '( x - 2 ) ( 4 x + 2 )', '( x - 2 ) ( - 4 x + 4 )', '( x - 2 ) ( - 2 x + 4 )', '( x - 2 ) * 4', '( x - 2 ) ( 2 x + 4 )', '( 2 x - 2 ) ( - 2 x - 4 )', '( 2 x - 2 ) * ( - 4 )', '( 2 x - 2 ) ( 2 x - 4 )', '( 2 x - 2 ) ( - 4 x - 2 )', '( 2 x - 2 ) * ( - 2 )', '( 2 x - 2 ) ( 2 x - 2 )', '( 2 x - 2 ) ( 4 x - 2 )', '( 2 x - 2 ) * ( - 4 x )', '( 2 x - 2 ) * ( - 2 x )', '( 2 x - 2 ) * 2 x', '( 2 x - 2 ) * 4 x', '( 2 x - 2 ) ( - 4 x + 2 )', '( 2 x - 2 ) ( - 2 x + 2 )', '( 2 x - 2 ) * 2', '( 2 x - 2 ) ( 4 x + 2 )', '( 2 x - 2 ) ( - 4 x + 4 )', '( 2 x - 2 ) ( - 2 x + 4 )', '( 2 x - 2 ) * 4', '( 2 x - 2 ) ( 2 x + 4 )', '( - 2 x - 1 ) ( - 2 x - 4 )', '( - 2 x - 1 ) * ( - 4 )', '( - 2 x - 1 ) ( 2 x - 4 )', '( - 2 x - 1 ) ( 4 x - 4 )', '( - 2 x - 1 ) * ( - 2 )', '( - 2 x - 1 ) ( 2 x - 2 )', '( - 2 x - 1 ) ( 4 x - 2 )', '( - 2 x - 1 ) * ( - 4 x )', '( - 2 x - 1 ) * ( - 2 x )', '( - 2 x - 1 ) * 2 x', '( - 2 x - 1 ) * 4 x', '( - 2 x - 1 ) ( - 4 x + 2 )', '( - 2 x - 1 ) ( - 2 x + 2 )', '( - 2 x - 1 ) * 2', '( - 2 x - 1 ) ( 4 x + 2 )', '( - 2 x - 1 ) ( - 4 x + 4 )', '( - 2 x - 1 ) ( - 2 x + 4 )', '( - 2 x - 1 ) * 4', '( - 2 x - 1 ) ( 2 x + 4 )', '- 1 ( - 2 x - 4 )', '- 1 * ( - 4 )', '- 1 ( 2 x - 4 )', '- 1 ( 4 x - 4 )', '- 1 ( - 4 x - 2 )', '- 1 ( 2 x - 2 )', '- 1 ( 4 x - 2 )', '- 1 * ( - 4 x )', '- 1 * ( - 2 x )', '- 1 * 2 x', '- 1 * 4 x', '- 1 ( - 4 x + 2 )', '- 1 ( - 2 x + 2 )', '- 1 * 2', '- 1 ( 4 x + 2 )', '- 1 ( - 4 x + 4 )', '- 1 ( - 2 x + 4 )', '- 1 * 4', '- 1 ( 2 x + 4 )', '( x - 1 ) ( - 2 x - 4 )', '( x - 1 ) * ( - 4 )', '( x - 1 ) ( 2 x - 4 )', '( x - 1 ) ( 4 x - 4 )', '( x - 1 ) ( - 4 x - 2 )', '( x - 1 ) * ( - 2 )', '( x - 1 ) ( 4 x - 2 )', '( x - 1 ) * ( - 4 x )', '( x - 1 ) * ( - 2 x )', '( x - 1 ) * 2 x', '( x - 1 ) * 4 x', '( x - 1 ) ( - 4 x + 2 )', '( x - 1 ) ( - 2 x + 2 )', '( x - 1 ) * 2', '( x - 1 ) ( 4 x + 2 )', '( x - 1 ) ( - 4 x + 4 )', '( x - 1 ) ( - 2 x + 4 )', '( x - 1 ) * 4', '( x - 1 ) ( 2 x + 4 )', '( 2 x - 1 ) ( - 2 x - 4 )', '( 2 x - 1 ) * ( - 4 )', '( 2 x - 1 ) ( 2 x - 4 )', '( 2 x - 1 ) ( 4 x - 4 )', '( 2 x - 1 ) ( - 4 x - 2 )', '( 2 x - 1 ) * ( - 2 )', '( 2 x - 1 ) ( 2 x - 2 )', '( 2 x - 1 ) * ( - 4 x )', '( 2 x - 1 ) * ( - 2 x )', '( 2 x - 1 ) * 2 x', '( 2 x - 1 ) * 4 x', '( 2 x - 1 ) ( - 4 x + 2 )', '( 2 x - 1 ) ( - 2 x + 2 )', '( 2 x - 1 ) * 2', '( 2 x - 1 ) ( 4 x + 2 )', '( 2 x - 1 ) ( - 4 x + 4 )', '( 2 x - 1 ) ( - 2 x + 4 )', '( 2 x - 1 ) * 4', '( 2 x - 1 ) ( 2 x + 4 )', '- 2 x ( - 2 x - 4 )', '- 2 x * ( - 4 )', '- 2 x ( 2 x - 4 )', '- 2 x ( 4 x - 4 )', '- 2 x ( - 4 x - 2 )', '- 2 x * ( - 2 )', '- 2 x ( 2 x - 2 )', '- 2 x ( 4 x - 2 )', '- 2 x * ( - 2 x )', '- 2 x * 2 x', '- 2 x * 4 x', '- 2 x ( - 4 x + 2 )', '- 2 x ( - 2 x + 2 )', '- 2 x * 2', '- 2 x ( 4 x + 2 )', '- 2 x ( - 4 x + 4 )', '- 2 x ( - 2 x + 4 )', '- 2 x * 4', '- 2 x ( 2 x + 4 )', '- x ( - 2 x - 4 )', '- x * ( - 4 )', '- x ( 2 x - 4 )', '- x ( 4 x - 4 )', '- x ( - 4 x - 2 )', '- x * ( - 2 )', '- x ( 2 x - 2 )', '- x ( 4 x - 2 )', '- x * ( - 4 x )', '- x * 2 x', '- x * 4 x', '- x ( - 4 x + 2 )', '- x ( - 2 x + 2 )', '- x * 2', '- x ( 4 x + 2 )', '- x ( - 4 x + 4 )', '- x ( - 2 x + 4 )', '- x * 4', '- x ( 2 x + 4 )', 'x ( - 2 x - 4 )', 'x * ( - 4 )', 'x ( 2 x - 4 )', 'x ( 4 x - 4 )', 'x ( - 4 x - 2 )', 'x * ( - 2 )', 'x ( 2 x - 2 )', 'x ( 4 x - 2 )', 'x * ( - 4 x )', 'x * ( - 2 x )', 'x * 4 x', 'x ( - 4 x + 2 )', 'x ( - 2 x + 2 )', 'x * 2', 'x ( 4 x + 2 )', 'x ( - 4 x + 4 )', 'x ( - 2 x + 4 )', 'x * 4', 'x ( 2 x + 4 )', '2 x ( - 2 x - 4 )', '2 x * ( - 4 )', '2 x ( 2 x - 4 )', '2 x ( 4 x - 4 )', '2 x ( - 4 x - 2 )', '2 x * ( - 2 )', '2 x ( 2 x - 2 )', '2 x ( 4 x - 2 )', '2 x * ( - 4 x )', '2 x * ( - 2 x )', '2 x * 2 x', '2 x ( - 4 x + 2 )', '2 x ( - 2 x + 2 )', '2 x * 2', '2 x ( 4 x + 2 )', '2 x ( - 4 x + 4 )', '2 x ( - 2 x + 4 )', '2 x * 4', '2 x ( 2 x + 4 )', '( - 2 x + 1 ) ( - 2 x - 4 )', '( - 2 x + 1 ) * ( - 4 )', '( - 2 x + 1 ) ( 2 x - 4 )', '( - 2 x + 1 ) ( 4 x - 4 )', '( - 2 x + 1 ) ( - 4 x - 2 )', '( - 2 x + 1 ) * ( - 2 )', '( - 2 x + 1 ) ( 2 x - 2 )', '( - 2 x + 1 ) ( 4 x - 2 )', '( - 2 x + 1 ) * ( - 4 x )', '( - 2 x + 1 ) * ( - 2 x )', '( - 2 x + 1 ) * 2 x', '( - 2 x + 1 ) * 4 x', '( - 2 x + 1 ) ( - 2 x + 2 )', '( - 2 x + 1 ) * 2', '( - 2 x + 1 ) ( 4 x + 2 )', '( - 2 x + 1 ) ( - 4 x + 4 )', '( - 2 x + 1 ) ( - 2 x + 4 )', '( - 2 x + 1 ) * 4', '( - 2 x + 1 ) ( 2 x + 4 )', '( - x + 1 ) ( - 2 x - 4 )', '( - x + 1 ) * ( - 4 )', '( - x + 1 ) ( 2 x - 4 )', '( - x + 1 ) ( 4 x - 4 )', '( - x + 1 ) ( - 4 x - 2 )', '( - x + 1 ) * ( - 2 )', '( - x + 1 ) ( 2 x - 2 )', '( - x + 1 ) ( 4 x - 2 )', '( - x + 1 ) * ( - 4 x )', '( - x + 1 ) * ( - 2 x )', '( - x + 1 ) * 2 x', '( - x + 1 ) * 4 x', '( - x + 1 ) ( - 4 x + 2 )', '( - x + 1 ) * 2', '( - x + 1 ) ( 4 x + 2 )', '( - x + 1 ) ( - 4 x + 4 )', '( - x + 1 ) ( - 2 x + 4 )', '( - x + 1 ) * 4', '( - x + 1 ) ( 2 x + 4 )', '1 ( - 2 x - 4 )', '1 * ( - 4 )', '1 ( 2 x - 4 )', '1 ( 4 x - 4 )', '1 ( - 4 x - 2 )', '1 * ( - 2 )', '1 ( 2 x - 2 )', '1 ( 4 x - 2 )', '1 * ( - 4 x )', '1 * ( - 2 x )', '1 * 2 x', '1 * 4 x', '1 ( - 4 x + 2 )', '1 ( - 2 x + 2 )', '1 ( 4 x + 2 )', '1 ( - 4 x + 4 )', '1 ( - 2 x + 4 )', '1 * 4', '1 ( 2 x + 4 )', '( 2 x + 1 ) ( - 2 x - 4 )', '( 2 x + 1 ) * ( - 4 )', '( 2 x + 1 ) ( 2 x - 4 )', '( 2 x + 1 ) ( 4 x - 4 )', '( 2 x + 1 ) ( - 4 x - 2 )', '( 2 x + 1 ) * ( - 2 )', '( 2 x + 1 ) ( 2 x - 2 )', '( 2 x + 1 ) ( 4 x - 2 )', '( 2 x + 1 ) * ( - 4 x )', '( 2 x + 1 ) * ( - 2 x )', '( 2 x + 1 ) * 2 x', '( 2 x + 1 ) * 4 x', '( 2 x + 1 ) ( - 4 x + 2 )', '( 2 x + 1 ) ( - 2 x + 2 )', '( 2 x + 1 ) * 2', '( 2 x + 1 ) ( - 4 x + 4 )', '( 2 x + 1 ) ( - 2 x + 4 )', '( 2 x + 1 ) * 4', '( 2 x + 1 ) ( 2 x + 4 )', '( - 2 x + 2 ) ( - 2 x - 4 )', '( - 2 x + 2 ) * ( - 4 )', '( - 2 x + 2 ) ( 2 x - 4 )', '( - 2 x + 2 ) ( 4 x - 4 )', '( - 2 x + 2 ) ( - 4 x - 2 )', '( - 2 x + 2 ) * ( - 2 )', '( - 2 x + 2 ) ( 2 x - 2 )', '( - 2 x + 2 ) ( 4 x - 2 )', '( - 2 x + 2 ) * ( - 4 x )', '( - 2 x + 2 ) * ( - 2 x )', '( - 2 x + 2 ) * 2 x', '( - 2 x + 2 ) * 4 x', '( - 2 x + 2 ) ( - 4 x + 2 )', '( - 2 x + 2 ) ( - 2 x + 2 )', '( - 2 x + 2 ) * 2', '( - 2 x + 2 ) ( 4 x + 2 )', '( - 2 x + 2 ) ( - 2 x + 4 )', '( - 2 x + 2 ) * 4', '( - 2 x + 2 ) ( 2 x + 4 )', '( - x + 2 ) ( - 2 x - 4 )', '( - x + 2 ) * ( - 4 )', '( - x + 2 ) ( 2 x - 4 )', '( - x + 2 ) ( 4 x - 4 )', '( - x + 2 ) ( - 4 x - 2 )', '( - x + 2 ) * ( - 2 )', '( - x + 2 ) ( 2 x - 2 )', '( - x + 2 ) ( 4 x - 2 )', '( - x + 2 ) * ( - 4 x )', '( - x + 2 ) * ( - 2 x )', '( - x + 2 ) * 2 x', '( - x + 2 ) * 4 x', '( - x + 2 ) ( - 4 x + 2 )', '( - x + 2 ) ( - 2 x + 2 )', '( - x + 2 ) * 2', '( - x + 2 ) ( 4 x + 2 )', '( - x + 2 ) ( - 4 x + 4 )', '( - x + 2 ) * 4', '( - x + 2 ) ( 2 x + 4 )', '2 ( - 2 x - 4 )', '2 * ( - 4 )', '2 ( 2 x - 4 )', '2 ( 4 x - 4 )', '2 ( - 4 x - 2 )', '2 * ( - 2 )', '2 ( 2 x - 2 )', '2 ( 4 x - 2 )', '2 * ( - 4 x )', '2 * ( - 2 x )', '2 * 2 x', '2 * 4 x', '2 ( - 4 x + 2 )', '2 ( - 2 x + 2 )', '2 * 2', '2 ( 4 x + 2 )', '2 ( - 4 x + 4 )', '2 ( - 2 x + 4 )', '2 ( 2 x + 4 )', '( x + 2 ) ( - 2 x - 4 )', '( x + 2 ) * ( - 4 )', '( x + 2 ) ( 2 x - 4 )', '( x + 2 ) ( 4 x - 4 )', '( x + 2 ) ( - 4 x - 2 )', '( x + 2 ) * ( - 2 )', '( x + 2 ) ( 2 x - 2 )', '( x + 2 ) ( 4 x - 2 )', '( x + 2 ) * ( - 4 x )', '( x + 2 ) * ( - 2 x )', '( x + 2 ) * 2 x', '( x + 2 ) * 4 x', '( x + 2 ) ( - 4 x + 2 )', '( x + 2 ) ( - 2 x + 2 )', '( x + 2 ) * 2', '( x + 2 ) ( 4 x + 2 )', '( x + 2 ) ( - 4 x + 4 )', '( x + 2 ) ( - 2 x + 4 )', '( x + 2 ) * 4'] +POLY_ADD_VALID_RESULTS = [ + '- x - 2 - 4', + '- x - 2 + 2 x - 4', + '- x - 2 + 4 x - 4', + '- x - 2 - 4 x - 2', + '- x - 2 - 2', + '- x - 2 + 2 x - 2', + '- x - 2 + 4 x - 2', + '- x - 2 - 4 x', + '- x - 2 - 2 x', + '- x - 2 + 2 x', + '- x - 2 + 4 x', + '- x - 2 - 4 x + 2', + '- x - 2 - 2 x + 2', + '- x - 2 + 2', + '- x - 2 + 4 x + 2', + '- x - 2 - 4 x + 4', + '- x - 2 - 2 x + 4', + '- x - 2 + 4', + '- x - 2 + 2 x + 4', + '- 2 - 2 x - 4', + '- 2 + 2 x - 4', + '- 2 + 4 x - 4', + '- 2 - 4 x - 2', + '- 2 - 2', + '- 2 + 2 x - 2', + '- 2 + 4 x - 2', + '- 2 - 4 x', + '- 2 - 2 x', + '- 2 + 2 x', + '- 2 + 4 x', + '- 2 - 4 x + 2', + '- 2 - 2 x + 2', + '- 2 + 2', + '- 2 + 4 x + 2', + '- 2 - 4 x + 4', + '- 2 - 2 x + 4', + '- 2 + 4', + '- 2 + 2 x + 4', + 'x - 2 - 2 x - 4', + 'x - 2 - 4', + 'x - 2 + 4 x - 4', + 'x - 2 - 4 x - 2', + 'x - 2 - 2', + 'x - 2 + 2 x - 2', + 'x - 2 + 4 x - 2', + 'x - 2 - 4 x', + 'x - 2 - 2 x', + 'x - 2 + 2 x', + 'x - 2 + 4 x', + 'x - 2 - 4 x + 2', + 'x - 2 - 2 x + 2', + 'x - 2 + 2', + 'x - 2 + 4 x + 2', + 'x - 2 - 4 x + 4', + 'x - 2 - 2 x + 4', + 'x - 2 + 4', + 'x - 2 + 2 x + 4', + '2 x - 2 - 2 x - 4', + '2 x - 2 - 4', + '2 x - 2 + 2 x - 4', + '2 x - 2 - 4 x - 2', + '2 x - 2 - 2', + '2 x - 2 + 2 x - 2', + '2 x - 2 + 4 x - 2', + '2 x - 2 - 4 x', + '2 x - 2 - 2 x', + '2 x - 2 + 2 x', + '2 x - 2 + 4 x', + '2 x - 2 - 4 x + 2', + '2 x - 2 - 2 x + 2', + '2 x - 2 + 2', + '2 x - 2 + 4 x + 2', + '2 x - 2 - 4 x + 4', + '2 x - 2 - 2 x + 4', + '2 x - 2 + 4', + '2 x - 2 + 2 x + 4', + '- 2 x - 1 - 2 x - 4', + '- 2 x - 1 - 4', + '- 2 x - 1 + 2 x - 4', + '- 2 x - 1 + 4 x - 4', + '- 2 x - 1 - 2', + '- 2 x - 1 + 2 x - 2', + '- 2 x - 1 + 4 x - 2', + '- 2 x - 1 - 4 x', + '- 2 x - 1 - 2 x', + '- 2 x - 1 + 2 x', + '- 2 x - 1 + 4 x', + '- 2 x - 1 - 4 x + 2', + '- 2 x - 1 - 2 x + 2', + '- 2 x - 1 + 2', + '- 2 x - 1 + 4 x + 2', + '- 2 x - 1 - 4 x + 4', + '- 2 x - 1 - 2 x + 4', + '- 2 x - 1 + 4', + '- 2 x - 1 + 2 x + 4', + '- 1 - 2 x - 4', + '- 1 - 4', + '- 1 + 2 x - 4', + '- 1 + 4 x - 4', + '- 1 - 4 x - 2', + '- 1 + 2 x - 2', + '- 1 + 4 x - 2', + '- 1 - 4 x', + '- 1 - 2 x', + '- 1 + 2 x', + '- 1 + 4 x', + '- 1 - 4 x + 2', + '- 1 - 2 x + 2', + '- 1 + 2', + '- 1 + 4 x + 2', + '- 1 - 4 x + 4', + '- 1 - 2 x + 4', + '- 1 + 4', + '- 1 + 2 x + 4', + 'x - 1 - 2 x - 4', + 'x - 1 - 4', + 'x - 1 + 2 x - 4', + 'x - 1 + 4 x - 4', + 'x - 1 - 4 x - 2', + 'x - 1 - 2', + 'x - 1 + 4 x - 2', + 'x - 1 - 4 x', + 'x - 1 - 2 x', + 'x - 1 + 2 x', + 'x - 1 + 4 x', + 'x - 1 - 4 x + 2', + 'x - 1 - 2 x + 2', + 'x - 1 + 2', + 'x - 1 + 4 x + 2', + 'x - 1 - 4 x + 4', + 'x - 1 - 2 x + 4', + 'x - 1 + 4', + 'x - 1 + 2 x + 4', + '2 x - 1 - 2 x - 4', + '2 x - 1 - 4', + '2 x - 1 + 2 x - 4', + '2 x - 1 + 4 x - 4', + '2 x - 1 - 4 x - 2', + '2 x - 1 - 2', + '2 x - 1 + 2 x - 2', + '2 x - 1 - 4 x', + '2 x - 1 - 2 x', + '2 x - 1 + 2 x', + '2 x - 1 + 4 x', + '2 x - 1 - 4 x + 2', + '2 x - 1 - 2 x + 2', + '2 x - 1 + 2', + '2 x - 1 + 4 x + 2', + '2 x - 1 - 4 x + 4', + '2 x - 1 - 2 x + 4', + '2 x - 1 + 4', + '2 x - 1 + 2 x + 4', + '- 2 x - 2 x - 4', + '- 2 x - 4', + '- 2 x + 2 x - 4', + '- 2 x + 4 x - 4', + '- 2 x - 4 x - 2', + '- 2 x - 2', + '- 2 x + 2 x - 2', + '- 2 x + 4 x - 2', + '- 2 x - 2 x', + '- 2 x + 2 x', + '- 2 x + 4 x', + '- 2 x - 4 x + 2', + '- 2 x - 2 x + 2', + '- 2 x + 2', + '- 2 x + 4 x + 2', + '- 2 x - 4 x + 4', + '- 2 x - 2 x + 4', + '- 2 x + 4', + '- 2 x + 2 x + 4', + '- x - 2 x - 4', + '- x - 4', + '- x + 2 x - 4', + '- x + 4 x - 4', + '- x - 4 x - 2', + '- x - 2', + '- x + 2 x - 2', + '- x + 4 x - 2', + '- x - 4 x', + '- x + 2 x', + '- x + 4 x', + '- x - 4 x + 2', + '- x - 2 x + 2', + '- x + 2', + '- x + 4 x + 2', + '- x - 4 x + 4', + '- x - 2 x + 4', + '- x + 4', + '- x + 2 x + 4', + 'x - 2 x - 4', + 'x - 4', + 'x + 2 x - 4', + 'x + 4 x - 4', + 'x - 4 x - 2', + 'x - 2', + 'x + 2 x - 2', + 'x + 4 x - 2', + 'x - 4 x', + 'x - 2 x', + 'x + 4 x', + 'x - 4 x + 2', + 'x - 2 x + 2', + 'x + 2', + 'x + 4 x + 2', + 'x - 4 x + 4', + 'x - 2 x + 4', + 'x + 4', + 'x + 2 x + 4', + '2 x - 2 x - 4', + '2 x - 4', + '2 x + 2 x - 4', + '2 x + 4 x - 4', + '2 x - 4 x - 2', + '2 x - 2', + '2 x + 2 x - 2', + '2 x + 4 x - 2', + '2 x - 4 x', + '2 x - 2 x', + '2 x + 2 x', + '2 x - 4 x + 2', + '2 x - 2 x + 2', + '2 x + 2', + '2 x + 4 x + 2', + '2 x - 4 x + 4', + '2 x - 2 x + 4', + '2 x + 4', + '2 x + 2 x + 4', + '- 2 x + 1 - 2 x - 4', + '- 2 x + 1 - 4', + '- 2 x + 1 + 2 x - 4', + '- 2 x + 1 + 4 x - 4', + '- 2 x + 1 - 4 x - 2', + '- 2 x + 1 - 2', + '- 2 x + 1 + 2 x - 2', + '- 2 x + 1 + 4 x - 2', + '- 2 x + 1 - 4 x', + '- 2 x + 1 - 2 x', + '- 2 x + 1 + 2 x', + '- 2 x + 1 + 4 x', + '- 2 x + 1 - 2 x + 2', + '- 2 x + 1 + 2', + '- 2 x + 1 + 4 x + 2', + '- 2 x + 1 - 4 x + 4', + '- 2 x + 1 - 2 x + 4', + '- 2 x + 1 + 4', + '- 2 x + 1 + 2 x + 4', + '- x + 1 - 2 x - 4', + '- x + 1 - 4', + '- x + 1 + 2 x - 4', + '- x + 1 + 4 x - 4', + '- x + 1 - 4 x - 2', + '- x + 1 - 2', + '- x + 1 + 2 x - 2', + '- x + 1 + 4 x - 2', + '- x + 1 - 4 x', + '- x + 1 - 2 x', + '- x + 1 + 2 x', + '- x + 1 + 4 x', + '- x + 1 - 4 x + 2', + '- x + 1 + 2', + '- x + 1 + 4 x + 2', + '- x + 1 - 4 x + 4', + '- x + 1 - 2 x + 4', + '- x + 1 + 4', + '- x + 1 + 2 x + 4', + '1 - 2 x - 4', + '1 - 4', + '1 + 2 x - 4', + '1 + 4 x - 4', + '1 - 4 x - 2', + '1 - 2', + '1 + 2 x - 2', + '1 + 4 x - 2', + '1 - 4 x', + '1 - 2 x', + '1 + 2 x', + '1 + 4 x', + '1 - 4 x + 2', + '1 - 2 x + 2', + '1 + 4 x + 2', + '1 - 4 x + 4', + '1 - 2 x + 4', + '1 + 4', + '1 + 2 x + 4', + '2 x + 1 - 2 x - 4', + '2 x + 1 - 4', + '2 x + 1 + 2 x - 4', + '2 x + 1 + 4 x - 4', + '2 x + 1 - 4 x - 2', + '2 x + 1 - 2', + '2 x + 1 + 2 x - 2', + '2 x + 1 + 4 x - 2', + '2 x + 1 - 4 x', + '2 x + 1 - 2 x', + '2 x + 1 + 2 x', + '2 x + 1 + 4 x', + '2 x + 1 - 4 x + 2', + '2 x + 1 - 2 x + 2', + '2 x + 1 + 2', + '2 x + 1 - 4 x + 4', + '2 x + 1 - 2 x + 4', + '2 x + 1 + 4', + '2 x + 1 + 2 x + 4', + '- 2 x + 2 - 2 x - 4', + '- 2 x + 2 - 4', + '- 2 x + 2 + 2 x - 4', + '- 2 x + 2 + 4 x - 4', + '- 2 x + 2 - 4 x - 2', + '- 2 x + 2 - 2', + '- 2 x + 2 + 2 x - 2', + '- 2 x + 2 + 4 x - 2', + '- 2 x + 2 - 4 x', + '- 2 x + 2 - 2 x', + '- 2 x + 2 + 2 x', + '- 2 x + 2 + 4 x', + '- 2 x + 2 - 4 x + 2', + '- 2 x + 2 - 2 x + 2', + '- 2 x + 2 + 2', + '- 2 x + 2 + 4 x + 2', + '- 2 x + 2 - 2 x + 4', + '- 2 x + 2 + 4', + '- 2 x + 2 + 2 x + 4', + '- x + 2 - 2 x - 4', + '- x + 2 - 4', + '- x + 2 + 2 x - 4', + '- x + 2 + 4 x - 4', + '- x + 2 - 4 x - 2', + '- x + 2 - 2', + '- x + 2 + 2 x - 2', + '- x + 2 + 4 x - 2', + '- x + 2 - 4 x', + '- x + 2 - 2 x', + '- x + 2 + 2 x', + '- x + 2 + 4 x', + '- x + 2 - 4 x + 2', + '- x + 2 - 2 x + 2', + '- x + 2 + 2', + '- x + 2 + 4 x + 2', + '- x + 2 - 4 x + 4', + '- x + 2 + 4', + '- x + 2 + 2 x + 4', + '2 - 2 x - 4', + '2 - 4', + '2 + 2 x - 4', + '2 + 4 x - 4', + '2 - 4 x - 2', + '2 - 2', + '2 + 2 x - 2', + '2 + 4 x - 2', + '2 - 4 x', + '2 - 2 x', + '2 + 2 x', + '2 + 4 x', + '2 - 4 x + 2', + '2 - 2 x + 2', + '2 + 2', + '2 + 4 x + 2', + '2 - 4 x + 4', + '2 - 2 x + 4', + '2 + 2 x + 4', + 'x + 2 - 2 x - 4', + 'x + 2 - 4', + 'x + 2 + 2 x - 4', + 'x + 2 + 4 x - 4', + 'x + 2 - 4 x - 2', + 'x + 2 - 2', + 'x + 2 + 2 x - 2', + 'x + 2 + 4 x - 2', + 'x + 2 - 4 x', + 'x + 2 - 2 x', + 'x + 2 + 2 x', + 'x + 2 + 4 x', + 'x + 2 - 4 x + 2', + 'x + 2 - 2 x + 2', + 'x + 2 + 2', + 'x + 2 + 4 x + 2', + 'x + 2 - 4 x + 4', + 'x + 2 - 2 x + 4', + 'x + 2 + 4'] +POLY_SUB_VALID_RESULTS = [ + '- x - 2 - ( - 4 )', + '- x - 2 - ( 2 x - 4 )', + '- x - 2 - ( 4 x - 4 )', + '- x - 2 - ( - 4 x - 2 )', + '- x - 2 - ( - 2 )', + '- x - 2 - ( 2 x - 2 )', + '- x - 2 - ( 4 x - 2 )', + '- x - 2 - ( - 4 x )', + '- x - 2 - ( - 2 x )', + '- x - 2 - 2 x', + '- x - 2 - 4 x', + '- x - 2 - ( - 4 x + 2 )', + '- x - 2 - ( - 2 x + 2 )', + '- x - 2 - 2', + '- x - 2 - ( 4 x + 2 )', + '- x - 2 - ( - 4 x + 4 )', + '- x - 2 - ( - 2 x + 4 )', + '- x - 2 - 4', + '- x - 2 - ( 2 x + 4 )', + '- 2 - ( - 2 x - 4 )', + '- 2 - ( 2 x - 4 )', + '- 2 - ( 4 x - 4 )', + '- 2 - ( - 4 x - 2 )', + '- 2 - ( - 2 )', + '- 2 - ( 2 x - 2 )', + '- 2 - ( 4 x - 2 )', + '- 2 - ( - 4 x )', + '- 2 - ( - 2 x )', + '- 2 - 2 x', + '- 2 - 4 x', + '- 2 - ( - 4 x + 2 )', + '- 2 - ( - 2 x + 2 )', + '- 2 - 2', + '- 2 - ( 4 x + 2 )', + '- 2 - ( - 4 x + 4 )', + '- 2 - ( - 2 x + 4 )', + '- 2 - 4', + '- 2 - ( 2 x + 4 )', + 'x - 2 - ( - 2 x - 4 )', + 'x - 2 - ( - 4 )', + 'x - 2 - ( 4 x - 4 )', + 'x - 2 - ( - 4 x - 2 )', + 'x - 2 - ( - 2 )', + 'x - 2 - ( 2 x - 2 )', + 'x - 2 - ( 4 x - 2 )', + 'x - 2 - ( - 4 x )', + 'x - 2 - ( - 2 x )', + 'x - 2 - 2 x', + 'x - 2 - 4 x', + 'x - 2 - ( - 4 x + 2 )', + 'x - 2 - ( - 2 x + 2 )', + 'x - 2 - 2', + 'x - 2 - ( 4 x + 2 )', + 'x - 2 - ( - 4 x + 4 )', + 'x - 2 - ( - 2 x + 4 )', + 'x - 2 - 4', + 'x - 2 - ( 2 x + 4 )', + '2 x - 2 - ( - 2 x - 4 )', + '2 x - 2 - ( - 4 )', + '2 x - 2 - ( 2 x - 4 )', + '2 x - 2 - ( - 4 x - 2 )', + '2 x - 2 - ( - 2 )', + '2 x - 2 - ( 2 x - 2 )', + '2 x - 2 - ( 4 x - 2 )', + '2 x - 2 - ( - 4 x )', + '2 x - 2 - ( - 2 x )', + '2 x - 2 - 2 x', + '2 x - 2 - 4 x', + '2 x - 2 - ( - 4 x + 2 )', + '2 x - 2 - ( - 2 x + 2 )', + '2 x - 2 - 2', + '2 x - 2 - ( 4 x + 2 )', + '2 x - 2 - ( - 4 x + 4 )', + '2 x - 2 - ( - 2 x + 4 )', + '2 x - 2 - 4', + '2 x - 2 - ( 2 x + 4 )', + '- 2 x - 1 - ( - 2 x - 4 )', + '- 2 x - 1 - ( - 4 )', + '- 2 x - 1 - ( 2 x - 4 )', + '- 2 x - 1 - ( 4 x - 4 )', + '- 2 x - 1 - ( - 2 )', + '- 2 x - 1 - ( 2 x - 2 )', + '- 2 x - 1 - ( 4 x - 2 )', + '- 2 x - 1 - ( - 4 x )', + '- 2 x - 1 - ( - 2 x )', + '- 2 x - 1 - 2 x', + '- 2 x - 1 - 4 x', + '- 2 x - 1 - ( - 4 x + 2 )', + '- 2 x - 1 - ( - 2 x + 2 )', + '- 2 x - 1 - 2', + '- 2 x - 1 - ( 4 x + 2 )', + '- 2 x - 1 - ( - 4 x + 4 )', + '- 2 x - 1 - ( - 2 x + 4 )', + '- 2 x - 1 - 4', + '- 2 x - 1 - ( 2 x + 4 )', + '- 1 - ( - 2 x - 4 )', + '- 1 - ( - 4 )', + '- 1 - ( 2 x - 4 )', + '- 1 - ( 4 x - 4 )', + '- 1 - ( - 4 x - 2 )', + '- 1 - ( 2 x - 2 )', + '- 1 - ( 4 x - 2 )', + '- 1 - ( - 4 x )', + '- 1 - ( - 2 x )', + '- 1 - 2 x', + '- 1 - 4 x', + '- 1 - ( - 4 x + 2 )', + '- 1 - ( - 2 x + 2 )', + '- 1 - 2', + '- 1 - ( 4 x + 2 )', + '- 1 - ( - 4 x + 4 )', + '- 1 - ( - 2 x + 4 )', + '- 1 - 4', + '- 1 - ( 2 x + 4 )', + 'x - 1 - ( - 2 x - 4 )', + 'x - 1 - ( - 4 )', + 'x - 1 - ( 2 x - 4 )', + 'x - 1 - ( 4 x - 4 )', + 'x - 1 - ( - 4 x - 2 )', + 'x - 1 - ( - 2 )', + 'x - 1 - ( 4 x - 2 )', + 'x - 1 - ( - 4 x )', + 'x - 1 - ( - 2 x )', + 'x - 1 - 2 x', + 'x - 1 - 4 x', + 'x - 1 - ( - 4 x + 2 )', + 'x - 1 - ( - 2 x + 2 )', + 'x - 1 - 2', + 'x - 1 - ( 4 x + 2 )', + 'x - 1 - ( - 4 x + 4 )', + 'x - 1 - ( - 2 x + 4 )', + 'x - 1 - 4', + 'x - 1 - ( 2 x + 4 )', + '2 x - 1 - ( - 2 x - 4 )', + '2 x - 1 - ( - 4 )', + '2 x - 1 - ( 2 x - 4 )', + '2 x - 1 - ( 4 x - 4 )', + '2 x - 1 - ( - 4 x - 2 )', + '2 x - 1 - ( - 2 )', + '2 x - 1 - ( 2 x - 2 )', + '2 x - 1 - ( - 4 x )', + '2 x - 1 - ( - 2 x )', + '2 x - 1 - 2 x', + '2 x - 1 - 4 x', + '2 x - 1 - ( - 4 x + 2 )', + '2 x - 1 - ( - 2 x + 2 )', + '2 x - 1 - 2', + '2 x - 1 - ( 4 x + 2 )', + '2 x - 1 - ( - 4 x + 4 )', + '2 x - 1 - ( - 2 x + 4 )', + '2 x - 1 - 4', + '2 x - 1 - ( 2 x + 4 )', + '- 2 x - ( - 2 x - 4 )', + '- 2 x - ( - 4 )', + '- 2 x - ( 2 x - 4 )', + '- 2 x - ( 4 x - 4 )', + '- 2 x - ( - 4 x - 2 )', + '- 2 x - ( - 2 )', + '- 2 x - ( 2 x - 2 )', + '- 2 x - ( 4 x - 2 )', + '- 2 x - ( - 2 x )', + '- 2 x - 2 x', + '- 2 x - 4 x', + '- 2 x - ( - 4 x + 2 )', + '- 2 x - ( - 2 x + 2 )', + '- 2 x - 2', + '- 2 x - ( 4 x + 2 )', + '- 2 x - ( - 4 x + 4 )', + '- 2 x - ( - 2 x + 4 )', + '- 2 x - 4', + '- 2 x - ( 2 x + 4 )', + '- x - ( - 2 x - 4 )', + '- x - ( - 4 )', + '- x - ( 2 x - 4 )', + '- x - ( 4 x - 4 )', + '- x - ( - 4 x - 2 )', + '- x - ( - 2 )', + '- x - ( 2 x - 2 )', + '- x - ( 4 x - 2 )', + '- x - ( - 4 x )', + '- x - 2 x', + '- x - 4 x', + '- x - ( - 4 x + 2 )', + '- x - ( - 2 x + 2 )', + '- x - 2', + '- x - ( 4 x + 2 )', + '- x - ( - 4 x + 4 )', + '- x - ( - 2 x + 4 )', + '- x - 4', + '- x - ( 2 x + 4 )', + 'x - ( - 2 x - 4 )', + 'x - ( - 4 )', + 'x - ( 2 x - 4 )', + 'x - ( 4 x - 4 )', + 'x - ( - 4 x - 2 )', + 'x - ( - 2 )', + 'x - ( 2 x - 2 )', + 'x - ( 4 x - 2 )', + 'x - ( - 4 x )', + 'x - ( - 2 x )', + 'x - 4 x', + 'x - ( - 4 x + 2 )', + 'x - ( - 2 x + 2 )', + 'x - 2', + 'x - ( 4 x + 2 )', + 'x - ( - 4 x + 4 )', + 'x - ( - 2 x + 4 )', + 'x - 4', + 'x - ( 2 x + 4 )', + '2 x - ( - 2 x - 4 )', + '2 x - ( - 4 )', + '2 x - ( 2 x - 4 )', + '2 x - ( 4 x - 4 )', + '2 x - ( - 4 x - 2 )', + '2 x - ( - 2 )', + '2 x - ( 2 x - 2 )', + '2 x - ( 4 x - 2 )', + '2 x - ( - 4 x )', + '2 x - ( - 2 x )', + '2 x - 2 x', + '2 x - ( - 4 x + 2 )', + '2 x - ( - 2 x + 2 )', + '2 x - 2', + '2 x - ( 4 x + 2 )', + '2 x - ( - 4 x + 4 )', + '2 x - ( - 2 x + 4 )', + '2 x - 4', + '2 x - ( 2 x + 4 )', + '- 2 x + 1 - ( - 2 x - 4 )', + '- 2 x + 1 - ( - 4 )', + '- 2 x + 1 - ( 2 x - 4 )', + '- 2 x + 1 - ( 4 x - 4 )', + '- 2 x + 1 - ( - 4 x - 2 )', + '- 2 x + 1 - ( - 2 )', + '- 2 x + 1 - ( 2 x - 2 )', + '- 2 x + 1 - ( 4 x - 2 )', + '- 2 x + 1 - ( - 4 x )', + '- 2 x + 1 - ( - 2 x )', + '- 2 x + 1 - 2 x', + '- 2 x + 1 - 4 x', + '- 2 x + 1 - ( - 2 x + 2 )', + '- 2 x + 1 - 2', + '- 2 x + 1 - ( 4 x + 2 )', + '- 2 x + 1 - ( - 4 x + 4 )', + '- 2 x + 1 - ( - 2 x + 4 )', + '- 2 x + 1 - 4', + '- 2 x + 1 - ( 2 x + 4 )', + '- x + 1 - ( - 2 x - 4 )', + '- x + 1 - ( - 4 )', + '- x + 1 - ( 2 x - 4 )', + '- x + 1 - ( 4 x - 4 )', + '- x + 1 - ( - 4 x - 2 )', + '- x + 1 - ( - 2 )', + '- x + 1 - ( 2 x - 2 )', + '- x + 1 - ( 4 x - 2 )', + '- x + 1 - ( - 4 x )', + '- x + 1 - ( - 2 x )', + '- x + 1 - 2 x', + '- x + 1 - 4 x', + '- x + 1 - ( - 4 x + 2 )', + '- x + 1 - 2', + '- x + 1 - ( 4 x + 2 )', + '- x + 1 - ( - 4 x + 4 )', + '- x + 1 - ( - 2 x + 4 )', + '- x + 1 - 4', + '- x + 1 - ( 2 x + 4 )', + '1 - ( - 2 x - 4 )', + '1 - ( - 4 )', + '1 - ( 2 x - 4 )', + '1 - ( 4 x - 4 )', + '1 - ( - 4 x - 2 )', + '1 - ( - 2 )', + '1 - ( 2 x - 2 )', + '1 - ( 4 x - 2 )', + '1 - ( - 4 x )', + '1 - ( - 2 x )', + '1 - 2 x', + '1 - 4 x', + '1 - ( - 4 x + 2 )', + '1 - ( - 2 x + 2 )', + '1 - ( 4 x + 2 )', + '1 - ( - 4 x + 4 )', + '1 - ( - 2 x + 4 )', + '1 - 4', + '1 - ( 2 x + 4 )', + '2 x + 1 - ( - 2 x - 4 )', + '2 x + 1 - ( - 4 )', + '2 x + 1 - ( 2 x - 4 )', + '2 x + 1 - ( 4 x - 4 )', + '2 x + 1 - ( - 4 x - 2 )', + '2 x + 1 - ( - 2 )', + '2 x + 1 - ( 2 x - 2 )', + '2 x + 1 - ( 4 x - 2 )', + '2 x + 1 - ( - 4 x )', + '2 x + 1 - ( - 2 x )', + '2 x + 1 - 2 x', + '2 x + 1 - 4 x', + '2 x + 1 - ( - 4 x + 2 )', + '2 x + 1 - ( - 2 x + 2 )', + '2 x + 1 - 2', + '2 x + 1 - ( - 4 x + 4 )', + '2 x + 1 - ( - 2 x + 4 )', + '2 x + 1 - 4', + '2 x + 1 - ( 2 x + 4 )', + '- 2 x + 2 - ( - 2 x - 4 )', + '- 2 x + 2 - ( - 4 )', + '- 2 x + 2 - ( 2 x - 4 )', + '- 2 x + 2 - ( 4 x - 4 )', + '- 2 x + 2 - ( - 4 x - 2 )', + '- 2 x + 2 - ( - 2 )', + '- 2 x + 2 - ( 2 x - 2 )', + '- 2 x + 2 - ( 4 x - 2 )', + '- 2 x + 2 - ( - 4 x )', + '- 2 x + 2 - ( - 2 x )', + '- 2 x + 2 - 2 x', + '- 2 x + 2 - 4 x', + '- 2 x + 2 - ( - 4 x + 2 )', + '- 2 x + 2 - ( - 2 x + 2 )', + '- 2 x + 2 - 2', + '- 2 x + 2 - ( 4 x + 2 )', + '- 2 x + 2 - ( - 2 x + 4 )', + '- 2 x + 2 - 4', + '- 2 x + 2 - ( 2 x + 4 )', + '- x + 2 - ( - 2 x - 4 )', + '- x + 2 - ( - 4 )', + '- x + 2 - ( 2 x - 4 )', + '- x + 2 - ( 4 x - 4 )', + '- x + 2 - ( - 4 x - 2 )', + '- x + 2 - ( - 2 )', + '- x + 2 - ( 2 x - 2 )', + '- x + 2 - ( 4 x - 2 )', + '- x + 2 - ( - 4 x )', + '- x + 2 - ( - 2 x )', + '- x + 2 - 2 x', + '- x + 2 - 4 x', + '- x + 2 - ( - 4 x + 2 )', + '- x + 2 - ( - 2 x + 2 )', + '- x + 2 - 2', + '- x + 2 - ( 4 x + 2 )', + '- x + 2 - ( - 4 x + 4 )', + '- x + 2 - 4', + '- x + 2 - ( 2 x + 4 )', + '2 - ( - 2 x - 4 )', + '2 - ( - 4 )', + '2 - ( 2 x - 4 )', + '2 - ( 4 x - 4 )', + '2 - ( - 4 x - 2 )', + '2 - ( - 2 )', + '2 - ( 2 x - 2 )', + '2 - ( 4 x - 2 )', + '2 - ( - 4 x )', + '2 - ( - 2 x )', + '2 - 2 x', + '2 - 4 x', + '2 - ( - 4 x + 2 )', + '2 - ( - 2 x + 2 )', + '2 - 2', + '2 - ( 4 x + 2 )', + '2 - ( - 4 x + 4 )', + '2 - ( - 2 x + 4 )', + '2 - ( 2 x + 4 )', + 'x + 2 - ( - 2 x - 4 )', + 'x + 2 - ( - 4 )', + 'x + 2 - ( 2 x - 4 )', + 'x + 2 - ( 4 x - 4 )', + 'x + 2 - ( - 4 x - 2 )', + 'x + 2 - ( - 2 )', + 'x + 2 - ( 2 x - 2 )', + 'x + 2 - ( 4 x - 2 )', + 'x + 2 - ( - 4 x )', + 'x + 2 - ( - 2 x )', + 'x + 2 - 2 x', + 'x + 2 - 4 x', + 'x + 2 - ( - 4 x + 2 )', + 'x + 2 - ( - 2 x + 2 )', + 'x + 2 - 2', + 'x + 2 - ( 4 x + 2 )', + 'x + 2 - ( - 4 x + 4 )', + 'x + 2 - ( - 2 x + 4 )', + 'x + 2 - 4'] +TEX_POLY_MUL_VALID_RESULTS = [ + '( - x - 2 ) \\times ( - 4 )', + '( - x - 2 ) ( 2 x - 4 )', + '( - x - 2 ) ( 4 x - 4 )', + '( - x - 2 ) ( - 4 x - 2 )', + '( - x - 2 ) \\times ( - 2 )', + '( - x - 2 ) ( 2 x - 2 )', + '( - x - 2 ) ( 4 x - 2 )', + '( - x - 2 ) \\times ( - 4 x )', + '( - x - 2 ) \\times ( - 2 x )', + '( - x - 2 ) \\times 2 x', + '( - x - 2 ) \\times 4 x', + '( - x - 2 ) ( - 4 x + 2 )', + '( - x - 2 ) ( - 2 x + 2 )', + '( - x - 2 ) \\times 2', + '( - x - 2 ) ( 4 x + 2 )', + '( - x - 2 ) ( - 4 x + 4 )', + '( - x - 2 ) ( - 2 x + 4 )', + '( - x - 2 ) \\times 4', + '( - x - 2 ) ( 2 x + 4 )', + '- 2 ( - 2 x - 4 )', + '- 2 ( 2 x - 4 )', + '- 2 ( 4 x - 4 )', + '- 2 ( - 4 x - 2 )', + '- 2 \\times ( - 2 )', + '- 2 ( 2 x - 2 )', + '- 2 ( 4 x - 2 )', + '- 2 \\times ( - 4 x )', + '- 2 \\times ( - 2 x )', + '- 2 \\times 2 x', + '- 2 \\times 4 x', + '- 2 ( - 4 x + 2 )', + '- 2 ( - 2 x + 2 )', + '- 2 \\times 2', + '- 2 ( 4 x + 2 )', + '- 2 ( - 4 x + 4 )', + '- 2 ( - 2 x + 4 )', + '- 2 \\times 4', + '- 2 ( 2 x + 4 )', + '( x - 2 ) ( - 2 x - 4 )', + '( x - 2 ) \\times ( - 4 )', + '( x - 2 ) ( 4 x - 4 )', + '( x - 2 ) ( - 4 x - 2 )', + '( x - 2 ) \\times ( - 2 )', + '( x - 2 ) ( 2 x - 2 )', + '( x - 2 ) ( 4 x - 2 )', + '( x - 2 ) \\times ( - 4 x )', + '( x - 2 ) \\times ( - 2 x )', + '( x - 2 ) \\times 2 x', + '( x - 2 ) \\times 4 x', + '( x - 2 ) ( - 4 x + 2 )', + '( x - 2 ) ( - 2 x + 2 )', + '( x - 2 ) \\times 2', + '( x - 2 ) ( 4 x + 2 )', + '( x - 2 ) ( - 4 x + 4 )', + '( x - 2 ) ( - 2 x + 4 )', + '( x - 2 ) \\times 4', + '( x - 2 ) ( 2 x + 4 )', + '( 2 x - 2 ) ( - 2 x - 4 )', + '( 2 x - 2 ) \\times ( - 4 )', + '( 2 x - 2 ) ( 2 x - 4 )', + '( 2 x - 2 ) ( - 4 x - 2 )', + '( 2 x - 2 ) \\times ( - 2 )', + '( 2 x - 2 ) ( 2 x - 2 )', + '( 2 x - 2 ) ( 4 x - 2 )', + '( 2 x - 2 ) \\times ( - 4 x )', + '( 2 x - 2 ) \\times ( - 2 x )', + '( 2 x - 2 ) \\times 2 x', + '( 2 x - 2 ) \\times 4 x', + '( 2 x - 2 ) ( - 4 x + 2 )', + '( 2 x - 2 ) ( - 2 x + 2 )', + '( 2 x - 2 ) \\times 2', + '( 2 x - 2 ) ( 4 x + 2 )', + '( 2 x - 2 ) ( - 4 x + 4 )', + '( 2 x - 2 ) ( - 2 x + 4 )', + '( 2 x - 2 ) \\times 4', + '( 2 x - 2 ) ( 2 x + 4 )', + '( - 2 x - 1 ) ( - 2 x - 4 )', + '( - 2 x - 1 ) \\times ( - 4 )', + '( - 2 x - 1 ) ( 2 x - 4 )', + '( - 2 x - 1 ) ( 4 x - 4 )', + '( - 2 x - 1 ) \\times ( - 2 )', + '( - 2 x - 1 ) ( 2 x - 2 )', + '( - 2 x - 1 ) ( 4 x - 2 )', + '( - 2 x - 1 ) \\times ( - 4 x )', + '( - 2 x - 1 ) \\times ( - 2 x )', + '( - 2 x - 1 ) \\times 2 x', + '( - 2 x - 1 ) \\times 4 x', + '( - 2 x - 1 ) ( - 4 x + 2 )', + '( - 2 x - 1 ) ( - 2 x + 2 )', + '( - 2 x - 1 ) \\times 2', + '( - 2 x - 1 ) ( 4 x + 2 )', + '( - 2 x - 1 ) ( - 4 x + 4 )', + '( - 2 x - 1 ) ( - 2 x + 4 )', + '( - 2 x - 1 ) \\times 4', + '( - 2 x - 1 ) ( 2 x + 4 )', + '- 1 ( - 2 x - 4 )', + '- 1 \\times ( - 4 )', + '- 1 ( 2 x - 4 )', + '- 1 ( 4 x - 4 )', + '- 1 ( - 4 x - 2 )', + '- 1 ( 2 x - 2 )', + '- 1 ( 4 x - 2 )', + '- 1 \\times ( - 4 x )', + '- 1 \\times ( - 2 x )', + '- 1 \\times 2 x', + '- 1 \\times 4 x', + '- 1 ( - 4 x + 2 )', + '- 1 ( - 2 x + 2 )', + '- 1 \\times 2', + '- 1 ( 4 x + 2 )', + '- 1 ( - 4 x + 4 )', + '- 1 ( - 2 x + 4 )', + '- 1 \\times 4', + '- 1 ( 2 x + 4 )', + '( x - 1 ) ( - 2 x - 4 )', + '( x - 1 ) \\times ( - 4 )', + '( x - 1 ) ( 2 x - 4 )', + '( x - 1 ) ( 4 x - 4 )', + '( x - 1 ) ( - 4 x - 2 )', + '( x - 1 ) \\times ( - 2 )', + '( x - 1 ) ( 4 x - 2 )', + '( x - 1 ) \\times ( - 4 x )', + '( x - 1 ) \\times ( - 2 x )', + '( x - 1 ) \\times 2 x', + '( x - 1 ) \\times 4 x', + '( x - 1 ) ( - 4 x + 2 )', + '( x - 1 ) ( - 2 x + 2 )', + '( x - 1 ) \\times 2', + '( x - 1 ) ( 4 x + 2 )', + '( x - 1 ) ( - 4 x + 4 )', + '( x - 1 ) ( - 2 x + 4 )', + '( x - 1 ) \\times 4', + '( x - 1 ) ( 2 x + 4 )', + '( 2 x - 1 ) ( - 2 x - 4 )', + '( 2 x - 1 ) \\times ( - 4 )', + '( 2 x - 1 ) ( 2 x - 4 )', + '( 2 x - 1 ) ( 4 x - 4 )', + '( 2 x - 1 ) ( - 4 x - 2 )', + '( 2 x - 1 ) \\times ( - 2 )', + '( 2 x - 1 ) ( 2 x - 2 )', + '( 2 x - 1 ) \\times ( - 4 x )', + '( 2 x - 1 ) \\times ( - 2 x )', + '( 2 x - 1 ) \\times 2 x', + '( 2 x - 1 ) \\times 4 x', + '( 2 x - 1 ) ( - 4 x + 2 )', + '( 2 x - 1 ) ( - 2 x + 2 )', + '( 2 x - 1 ) \\times 2', + '( 2 x - 1 ) ( 4 x + 2 )', + '( 2 x - 1 ) ( - 4 x + 4 )', + '( 2 x - 1 ) ( - 2 x + 4 )', + '( 2 x - 1 ) \\times 4', + '( 2 x - 1 ) ( 2 x + 4 )', + '- 2 x ( - 2 x - 4 )', + '- 2 x \\times ( - 4 )', + '- 2 x ( 2 x - 4 )', + '- 2 x ( 4 x - 4 )', + '- 2 x ( - 4 x - 2 )', + '- 2 x \\times ( - 2 )', + '- 2 x ( 2 x - 2 )', + '- 2 x ( 4 x - 2 )', + '- 2 x \\times ( - 2 x )', + '- 2 x \\times 2 x', + '- 2 x \\times 4 x', + '- 2 x ( - 4 x + 2 )', + '- 2 x ( - 2 x + 2 )', + '- 2 x \\times 2', + '- 2 x ( 4 x + 2 )', + '- 2 x ( - 4 x + 4 )', + '- 2 x ( - 2 x + 4 )', + '- 2 x \\times 4', + '- 2 x ( 2 x + 4 )', + '- x ( - 2 x - 4 )', + '- x \\times ( - 4 )', + '- x ( 2 x - 4 )', + '- x ( 4 x - 4 )', + '- x ( - 4 x - 2 )', + '- x \\times ( - 2 )', + '- x ( 2 x - 2 )', + '- x ( 4 x - 2 )', + '- x \\times ( - 4 x )', + '- x \\times 2 x', + '- x \\times 4 x', + '- x ( - 4 x + 2 )', + '- x ( - 2 x + 2 )', + '- x \\times 2', + '- x ( 4 x + 2 )', + '- x ( - 4 x + 4 )', + '- x ( - 2 x + 4 )', + '- x \\times 4', + '- x ( 2 x + 4 )', + 'x ( - 2 x - 4 )', + 'x \\times ( - 4 )', + 'x ( 2 x - 4 )', + 'x ( 4 x - 4 )', + 'x ( - 4 x - 2 )', + 'x \\times ( - 2 )', + 'x ( 2 x - 2 )', + 'x ( 4 x - 2 )', + 'x \\times ( - 4 x )', + 'x \\times ( - 2 x )', + 'x \\times 4 x', + 'x ( - 4 x + 2 )', + 'x ( - 2 x + 2 )', + 'x \\times 2', + 'x ( 4 x + 2 )', + 'x ( - 4 x + 4 )', + 'x ( - 2 x + 4 )', + 'x \\times 4', + 'x ( 2 x + 4 )', + '2 x ( - 2 x - 4 )', + '2 x \\times ( - 4 )', + '2 x ( 2 x - 4 )', + '2 x ( 4 x - 4 )', + '2 x ( - 4 x - 2 )', + '2 x \\times ( - 2 )', + '2 x ( 2 x - 2 )', + '2 x ( 4 x - 2 )', + '2 x \\times ( - 4 x )', + '2 x \\times ( - 2 x )', + '2 x \\times 2 x', + '2 x ( - 4 x + 2 )', + '2 x ( - 2 x + 2 )', + '2 x \\times 2', + '2 x ( 4 x + 2 )', + '2 x ( - 4 x + 4 )', + '2 x ( - 2 x + 4 )', + '2 x \\times 4', + '2 x ( 2 x + 4 )', + '( - 2 x + 1 ) ( - 2 x - 4 )', + '( - 2 x + 1 ) \\times ( - 4 )', + '( - 2 x + 1 ) ( 2 x - 4 )', + '( - 2 x + 1 ) ( 4 x - 4 )', + '( - 2 x + 1 ) ( - 4 x - 2 )', + '( - 2 x + 1 ) \\times ( - 2 )', + '( - 2 x + 1 ) ( 2 x - 2 )', + '( - 2 x + 1 ) ( 4 x - 2 )', + '( - 2 x + 1 ) \\times ( - 4 x )', + '( - 2 x + 1 ) \\times ( - 2 x )', + '( - 2 x + 1 ) \\times 2 x', + '( - 2 x + 1 ) \\times 4 x', + '( - 2 x + 1 ) ( - 2 x + 2 )', + '( - 2 x + 1 ) \\times 2', + '( - 2 x + 1 ) ( 4 x + 2 )', + '( - 2 x + 1 ) ( - 4 x + 4 )', + '( - 2 x + 1 ) ( - 2 x + 4 )', + '( - 2 x + 1 ) \\times 4', + '( - 2 x + 1 ) ( 2 x + 4 )', + '( - x + 1 ) ( - 2 x - 4 )', + '( - x + 1 ) \\times ( - 4 )', + '( - x + 1 ) ( 2 x - 4 )', + '( - x + 1 ) ( 4 x - 4 )', + '( - x + 1 ) ( - 4 x - 2 )', + '( - x + 1 ) \\times ( - 2 )', + '( - x + 1 ) ( 2 x - 2 )', + '( - x + 1 ) ( 4 x - 2 )', + '( - x + 1 ) \\times ( - 4 x )', + '( - x + 1 ) \\times ( - 2 x )', + '( - x + 1 ) \\times 2 x', + '( - x + 1 ) \\times 4 x', + '( - x + 1 ) ( - 4 x + 2 )', + '( - x + 1 ) \\times 2', + '( - x + 1 ) ( 4 x + 2 )', + '( - x + 1 ) ( - 4 x + 4 )', + '( - x + 1 ) ( - 2 x + 4 )', + '( - x + 1 ) \\times 4', + '( - x + 1 ) ( 2 x + 4 )', + '1 ( - 2 x - 4 )', + '1 \\times ( - 4 )', + '1 ( 2 x - 4 )', + '1 ( 4 x - 4 )', + '1 ( - 4 x - 2 )', + '1 \\times ( - 2 )', + '1 ( 2 x - 2 )', + '1 ( 4 x - 2 )', + '1 \\times ( - 4 x )', + '1 \\times ( - 2 x )', + '1 \\times 2 x', + '1 \\times 4 x', + '1 ( - 4 x + 2 )', + '1 ( - 2 x + 2 )', + '1 ( 4 x + 2 )', + '1 ( - 4 x + 4 )', + '1 ( - 2 x + 4 )', + '1 \\times 4', + '1 ( 2 x + 4 )', + '( 2 x + 1 ) ( - 2 x - 4 )', + '( 2 x + 1 ) \\times ( - 4 )', + '( 2 x + 1 ) ( 2 x - 4 )', + '( 2 x + 1 ) ( 4 x - 4 )', + '( 2 x + 1 ) ( - 4 x - 2 )', + '( 2 x + 1 ) \\times ( - 2 )', + '( 2 x + 1 ) ( 2 x - 2 )', + '( 2 x + 1 ) ( 4 x - 2 )', + '( 2 x + 1 ) \\times ( - 4 x )', + '( 2 x + 1 ) \\times ( - 2 x )', + '( 2 x + 1 ) \\times 2 x', + '( 2 x + 1 ) \\times 4 x', + '( 2 x + 1 ) ( - 4 x + 2 )', + '( 2 x + 1 ) ( - 2 x + 2 )', + '( 2 x + 1 ) \\times 2', + '( 2 x + 1 ) ( - 4 x + 4 )', + '( 2 x + 1 ) ( - 2 x + 4 )', + '( 2 x + 1 ) \\times 4', + '( 2 x + 1 ) ( 2 x + 4 )', + '( - 2 x + 2 ) ( - 2 x - 4 )', + '( - 2 x + 2 ) \\times ( - 4 )', + '( - 2 x + 2 ) ( 2 x - 4 )', + '( - 2 x + 2 ) ( 4 x - 4 )', + '( - 2 x + 2 ) ( - 4 x - 2 )', + '( - 2 x + 2 ) \\times ( - 2 )', + '( - 2 x + 2 ) ( 2 x - 2 )', + '( - 2 x + 2 ) ( 4 x - 2 )', + '( - 2 x + 2 ) \\times ( - 4 x )', + '( - 2 x + 2 ) \\times ( - 2 x )', + '( - 2 x + 2 ) \\times 2 x', + '( - 2 x + 2 ) \\times 4 x', + '( - 2 x + 2 ) ( - 4 x + 2 )', + '( - 2 x + 2 ) ( - 2 x + 2 )', + '( - 2 x + 2 ) \\times 2', + '( - 2 x + 2 ) ( 4 x + 2 )', + '( - 2 x + 2 ) ( - 2 x + 4 )', + '( - 2 x + 2 ) \\times 4', + '( - 2 x + 2 ) ( 2 x + 4 )', + '( - x + 2 ) ( - 2 x - 4 )', + '( - x + 2 ) \\times ( - 4 )', + '( - x + 2 ) ( 2 x - 4 )', + '( - x + 2 ) ( 4 x - 4 )', + '( - x + 2 ) ( - 4 x - 2 )', + '( - x + 2 ) \\times ( - 2 )', + '( - x + 2 ) ( 2 x - 2 )', + '( - x + 2 ) ( 4 x - 2 )', + '( - x + 2 ) \\times ( - 4 x )', + '( - x + 2 ) \\times ( - 2 x )', + '( - x + 2 ) \\times 2 x', + '( - x + 2 ) \\times 4 x', + '( - x + 2 ) ( - 4 x + 2 )', + '( - x + 2 ) ( - 2 x + 2 )', + '( - x + 2 ) \\times 2', + '( - x + 2 ) ( 4 x + 2 )', + '( - x + 2 ) ( - 4 x + 4 )', + '( - x + 2 ) \\times 4', + '( - x + 2 ) ( 2 x + 4 )', + '2 ( - 2 x - 4 )', + '2 \\times ( - 4 )', + '2 ( 2 x - 4 )', + '2 ( 4 x - 4 )', + '2 ( - 4 x - 2 )', + '2 \\times ( - 2 )', + '2 ( 2 x - 2 )', + '2 ( 4 x - 2 )', + '2 \\times ( - 4 x )', + '2 \\times ( - 2 x )', + '2 \\times 2 x', + '2 \\times 4 x', + '2 ( - 4 x + 2 )', + '2 ( - 2 x + 2 )', + '2 \\times 2', + '2 ( 4 x + 2 )', + '2 ( - 4 x + 4 )', + '2 ( - 2 x + 4 )', + '2 ( 2 x + 4 )', + '( x + 2 ) ( - 2 x - 4 )', + '( x + 2 ) \\times ( - 4 )', + '( x + 2 ) ( 2 x - 4 )', + '( x + 2 ) ( 4 x - 4 )', + '( x + 2 ) ( - 4 x - 2 )', + '( x + 2 ) \\times ( - 2 )', + '( x + 2 ) ( 2 x - 2 )', + '( x + 2 ) ( 4 x - 2 )', + '( x + 2 ) \\times ( - 4 x )', + '( x + 2 ) \\times ( - 2 x )', + '( x + 2 ) \\times 2 x', + '( x + 2 ) \\times 4 x', + '( x + 2 ) ( - 4 x + 2 )', + '( x + 2 ) ( - 2 x + 2 )', + '( x + 2 ) \\times 2', + '( x + 2 ) ( 4 x + 2 )', + '( x + 2 ) ( - 4 x + 4 )', + '( x + 2 ) ( - 2 x + 4 )', + '( x + 2 ) \\times 4'] +TXT_POLY_MUL_VALID_RESULTS = [ + '( - x - 2 ) * ( - 4 )', + '( - x - 2 ) ( 2 x - 4 )', + '( - x - 2 ) ( 4 x - 4 )', + '( - x - 2 ) ( - 4 x - 2 )', + '( - x - 2 ) * ( - 2 )', + '( - x - 2 ) ( 2 x - 2 )', + '( - x - 2 ) ( 4 x - 2 )', + '( - x - 2 ) * ( - 4 x )', + '( - x - 2 ) * ( - 2 x )', + '( - x - 2 ) * 2 x', + '( - x - 2 ) * 4 x', + '( - x - 2 ) ( - 4 x + 2 )', + '( - x - 2 ) ( - 2 x + 2 )', + '( - x - 2 ) * 2', + '( - x - 2 ) ( 4 x + 2 )', + '( - x - 2 ) ( - 4 x + 4 )', + '( - x - 2 ) ( - 2 x + 4 )', + '( - x - 2 ) * 4', + '( - x - 2 ) ( 2 x + 4 )', + '- 2 ( - 2 x - 4 )', + '- 2 ( 2 x - 4 )', + '- 2 ( 4 x - 4 )', + '- 2 ( - 4 x - 2 )', + '- 2 * ( - 2 )', + '- 2 ( 2 x - 2 )', + '- 2 ( 4 x - 2 )', + '- 2 * ( - 4 x )', + '- 2 * ( - 2 x )', + '- 2 * 2 x', + '- 2 * 4 x', + '- 2 ( - 4 x + 2 )', + '- 2 ( - 2 x + 2 )', + '- 2 * 2', + '- 2 ( 4 x + 2 )', + '- 2 ( - 4 x + 4 )', + '- 2 ( - 2 x + 4 )', + '- 2 * 4', + '- 2 ( 2 x + 4 )', + '( x - 2 ) ( - 2 x - 4 )', + '( x - 2 ) * ( - 4 )', + '( x - 2 ) ( 4 x - 4 )', + '( x - 2 ) ( - 4 x - 2 )', + '( x - 2 ) * ( - 2 )', + '( x - 2 ) ( 2 x - 2 )', + '( x - 2 ) ( 4 x - 2 )', + '( x - 2 ) * ( - 4 x )', + '( x - 2 ) * ( - 2 x )', + '( x - 2 ) * 2 x', + '( x - 2 ) * 4 x', + '( x - 2 ) ( - 4 x + 2 )', + '( x - 2 ) ( - 2 x + 2 )', + '( x - 2 ) * 2', + '( x - 2 ) ( 4 x + 2 )', + '( x - 2 ) ( - 4 x + 4 )', + '( x - 2 ) ( - 2 x + 4 )', + '( x - 2 ) * 4', + '( x - 2 ) ( 2 x + 4 )', + '( 2 x - 2 ) ( - 2 x - 4 )', + '( 2 x - 2 ) * ( - 4 )', + '( 2 x - 2 ) ( 2 x - 4 )', + '( 2 x - 2 ) ( - 4 x - 2 )', + '( 2 x - 2 ) * ( - 2 )', + '( 2 x - 2 ) ( 2 x - 2 )', + '( 2 x - 2 ) ( 4 x - 2 )', + '( 2 x - 2 ) * ( - 4 x )', + '( 2 x - 2 ) * ( - 2 x )', + '( 2 x - 2 ) * 2 x', + '( 2 x - 2 ) * 4 x', + '( 2 x - 2 ) ( - 4 x + 2 )', + '( 2 x - 2 ) ( - 2 x + 2 )', + '( 2 x - 2 ) * 2', + '( 2 x - 2 ) ( 4 x + 2 )', + '( 2 x - 2 ) ( - 4 x + 4 )', + '( 2 x - 2 ) ( - 2 x + 4 )', + '( 2 x - 2 ) * 4', + '( 2 x - 2 ) ( 2 x + 4 )', + '( - 2 x - 1 ) ( - 2 x - 4 )', + '( - 2 x - 1 ) * ( - 4 )', + '( - 2 x - 1 ) ( 2 x - 4 )', + '( - 2 x - 1 ) ( 4 x - 4 )', + '( - 2 x - 1 ) * ( - 2 )', + '( - 2 x - 1 ) ( 2 x - 2 )', + '( - 2 x - 1 ) ( 4 x - 2 )', + '( - 2 x - 1 ) * ( - 4 x )', + '( - 2 x - 1 ) * ( - 2 x )', + '( - 2 x - 1 ) * 2 x', + '( - 2 x - 1 ) * 4 x', + '( - 2 x - 1 ) ( - 4 x + 2 )', + '( - 2 x - 1 ) ( - 2 x + 2 )', + '( - 2 x - 1 ) * 2', + '( - 2 x - 1 ) ( 4 x + 2 )', + '( - 2 x - 1 ) ( - 4 x + 4 )', + '( - 2 x - 1 ) ( - 2 x + 4 )', + '( - 2 x - 1 ) * 4', + '( - 2 x - 1 ) ( 2 x + 4 )', + '- 1 ( - 2 x - 4 )', + '- 1 * ( - 4 )', + '- 1 ( 2 x - 4 )', + '- 1 ( 4 x - 4 )', + '- 1 ( - 4 x - 2 )', + '- 1 ( 2 x - 2 )', + '- 1 ( 4 x - 2 )', + '- 1 * ( - 4 x )', + '- 1 * ( - 2 x )', + '- 1 * 2 x', + '- 1 * 4 x', + '- 1 ( - 4 x + 2 )', + '- 1 ( - 2 x + 2 )', + '- 1 * 2', + '- 1 ( 4 x + 2 )', + '- 1 ( - 4 x + 4 )', + '- 1 ( - 2 x + 4 )', + '- 1 * 4', + '- 1 ( 2 x + 4 )', + '( x - 1 ) ( - 2 x - 4 )', + '( x - 1 ) * ( - 4 )', + '( x - 1 ) ( 2 x - 4 )', + '( x - 1 ) ( 4 x - 4 )', + '( x - 1 ) ( - 4 x - 2 )', + '( x - 1 ) * ( - 2 )', + '( x - 1 ) ( 4 x - 2 )', + '( x - 1 ) * ( - 4 x )', + '( x - 1 ) * ( - 2 x )', + '( x - 1 ) * 2 x', + '( x - 1 ) * 4 x', + '( x - 1 ) ( - 4 x + 2 )', + '( x - 1 ) ( - 2 x + 2 )', + '( x - 1 ) * 2', + '( x - 1 ) ( 4 x + 2 )', + '( x - 1 ) ( - 4 x + 4 )', + '( x - 1 ) ( - 2 x + 4 )', + '( x - 1 ) * 4', + '( x - 1 ) ( 2 x + 4 )', + '( 2 x - 1 ) ( - 2 x - 4 )', + '( 2 x - 1 ) * ( - 4 )', + '( 2 x - 1 ) ( 2 x - 4 )', + '( 2 x - 1 ) ( 4 x - 4 )', + '( 2 x - 1 ) ( - 4 x - 2 )', + '( 2 x - 1 ) * ( - 2 )', + '( 2 x - 1 ) ( 2 x - 2 )', + '( 2 x - 1 ) * ( - 4 x )', + '( 2 x - 1 ) * ( - 2 x )', + '( 2 x - 1 ) * 2 x', + '( 2 x - 1 ) * 4 x', + '( 2 x - 1 ) ( - 4 x + 2 )', + '( 2 x - 1 ) ( - 2 x + 2 )', + '( 2 x - 1 ) * 2', + '( 2 x - 1 ) ( 4 x + 2 )', + '( 2 x - 1 ) ( - 4 x + 4 )', + '( 2 x - 1 ) ( - 2 x + 4 )', + '( 2 x - 1 ) * 4', + '( 2 x - 1 ) ( 2 x + 4 )', + '- 2 x ( - 2 x - 4 )', + '- 2 x * ( - 4 )', + '- 2 x ( 2 x - 4 )', + '- 2 x ( 4 x - 4 )', + '- 2 x ( - 4 x - 2 )', + '- 2 x * ( - 2 )', + '- 2 x ( 2 x - 2 )', + '- 2 x ( 4 x - 2 )', + '- 2 x * ( - 2 x )', + '- 2 x * 2 x', + '- 2 x * 4 x', + '- 2 x ( - 4 x + 2 )', + '- 2 x ( - 2 x + 2 )', + '- 2 x * 2', + '- 2 x ( 4 x + 2 )', + '- 2 x ( - 4 x + 4 )', + '- 2 x ( - 2 x + 4 )', + '- 2 x * 4', + '- 2 x ( 2 x + 4 )', + '- x ( - 2 x - 4 )', + '- x * ( - 4 )', + '- x ( 2 x - 4 )', + '- x ( 4 x - 4 )', + '- x ( - 4 x - 2 )', + '- x * ( - 2 )', + '- x ( 2 x - 2 )', + '- x ( 4 x - 2 )', + '- x * ( - 4 x )', + '- x * 2 x', + '- x * 4 x', + '- x ( - 4 x + 2 )', + '- x ( - 2 x + 2 )', + '- x * 2', + '- x ( 4 x + 2 )', + '- x ( - 4 x + 4 )', + '- x ( - 2 x + 4 )', + '- x * 4', + '- x ( 2 x + 4 )', + 'x ( - 2 x - 4 )', + 'x * ( - 4 )', + 'x ( 2 x - 4 )', + 'x ( 4 x - 4 )', + 'x ( - 4 x - 2 )', + 'x * ( - 2 )', + 'x ( 2 x - 2 )', + 'x ( 4 x - 2 )', + 'x * ( - 4 x )', + 'x * ( - 2 x )', + 'x * 4 x', + 'x ( - 4 x + 2 )', + 'x ( - 2 x + 2 )', + 'x * 2', + 'x ( 4 x + 2 )', + 'x ( - 4 x + 4 )', + 'x ( - 2 x + 4 )', + 'x * 4', + 'x ( 2 x + 4 )', + '2 x ( - 2 x - 4 )', + '2 x * ( - 4 )', + '2 x ( 2 x - 4 )', + '2 x ( 4 x - 4 )', + '2 x ( - 4 x - 2 )', + '2 x * ( - 2 )', + '2 x ( 2 x - 2 )', + '2 x ( 4 x - 2 )', + '2 x * ( - 4 x )', + '2 x * ( - 2 x )', + '2 x * 2 x', + '2 x ( - 4 x + 2 )', + '2 x ( - 2 x + 2 )', + '2 x * 2', + '2 x ( 4 x + 2 )', + '2 x ( - 4 x + 4 )', + '2 x ( - 2 x + 4 )', + '2 x * 4', + '2 x ( 2 x + 4 )', + '( - 2 x + 1 ) ( - 2 x - 4 )', + '( - 2 x + 1 ) * ( - 4 )', + '( - 2 x + 1 ) ( 2 x - 4 )', + '( - 2 x + 1 ) ( 4 x - 4 )', + '( - 2 x + 1 ) ( - 4 x - 2 )', + '( - 2 x + 1 ) * ( - 2 )', + '( - 2 x + 1 ) ( 2 x - 2 )', + '( - 2 x + 1 ) ( 4 x - 2 )', + '( - 2 x + 1 ) * ( - 4 x )', + '( - 2 x + 1 ) * ( - 2 x )', + '( - 2 x + 1 ) * 2 x', + '( - 2 x + 1 ) * 4 x', + '( - 2 x + 1 ) ( - 2 x + 2 )', + '( - 2 x + 1 ) * 2', + '( - 2 x + 1 ) ( 4 x + 2 )', + '( - 2 x + 1 ) ( - 4 x + 4 )', + '( - 2 x + 1 ) ( - 2 x + 4 )', + '( - 2 x + 1 ) * 4', + '( - 2 x + 1 ) ( 2 x + 4 )', + '( - x + 1 ) ( - 2 x - 4 )', + '( - x + 1 ) * ( - 4 )', + '( - x + 1 ) ( 2 x - 4 )', + '( - x + 1 ) ( 4 x - 4 )', + '( - x + 1 ) ( - 4 x - 2 )', + '( - x + 1 ) * ( - 2 )', + '( - x + 1 ) ( 2 x - 2 )', + '( - x + 1 ) ( 4 x - 2 )', + '( - x + 1 ) * ( - 4 x )', + '( - x + 1 ) * ( - 2 x )', + '( - x + 1 ) * 2 x', + '( - x + 1 ) * 4 x', + '( - x + 1 ) ( - 4 x + 2 )', + '( - x + 1 ) * 2', + '( - x + 1 ) ( 4 x + 2 )', + '( - x + 1 ) ( - 4 x + 4 )', + '( - x + 1 ) ( - 2 x + 4 )', + '( - x + 1 ) * 4', + '( - x + 1 ) ( 2 x + 4 )', + '1 ( - 2 x - 4 )', + '1 * ( - 4 )', + '1 ( 2 x - 4 )', + '1 ( 4 x - 4 )', + '1 ( - 4 x - 2 )', + '1 * ( - 2 )', + '1 ( 2 x - 2 )', + '1 ( 4 x - 2 )', + '1 * ( - 4 x )', + '1 * ( - 2 x )', + '1 * 2 x', + '1 * 4 x', + '1 ( - 4 x + 2 )', + '1 ( - 2 x + 2 )', + '1 ( 4 x + 2 )', + '1 ( - 4 x + 4 )', + '1 ( - 2 x + 4 )', + '1 * 4', + '1 ( 2 x + 4 )', + '( 2 x + 1 ) ( - 2 x - 4 )', + '( 2 x + 1 ) * ( - 4 )', + '( 2 x + 1 ) ( 2 x - 4 )', + '( 2 x + 1 ) ( 4 x - 4 )', + '( 2 x + 1 ) ( - 4 x - 2 )', + '( 2 x + 1 ) * ( - 2 )', + '( 2 x + 1 ) ( 2 x - 2 )', + '( 2 x + 1 ) ( 4 x - 2 )', + '( 2 x + 1 ) * ( - 4 x )', + '( 2 x + 1 ) * ( - 2 x )', + '( 2 x + 1 ) * 2 x', + '( 2 x + 1 ) * 4 x', + '( 2 x + 1 ) ( - 4 x + 2 )', + '( 2 x + 1 ) ( - 2 x + 2 )', + '( 2 x + 1 ) * 2', + '( 2 x + 1 ) ( - 4 x + 4 )', + '( 2 x + 1 ) ( - 2 x + 4 )', + '( 2 x + 1 ) * 4', + '( 2 x + 1 ) ( 2 x + 4 )', + '( - 2 x + 2 ) ( - 2 x - 4 )', + '( - 2 x + 2 ) * ( - 4 )', + '( - 2 x + 2 ) ( 2 x - 4 )', + '( - 2 x + 2 ) ( 4 x - 4 )', + '( - 2 x + 2 ) ( - 4 x - 2 )', + '( - 2 x + 2 ) * ( - 2 )', + '( - 2 x + 2 ) ( 2 x - 2 )', + '( - 2 x + 2 ) ( 4 x - 2 )', + '( - 2 x + 2 ) * ( - 4 x )', + '( - 2 x + 2 ) * ( - 2 x )', + '( - 2 x + 2 ) * 2 x', + '( - 2 x + 2 ) * 4 x', + '( - 2 x + 2 ) ( - 4 x + 2 )', + '( - 2 x + 2 ) ( - 2 x + 2 )', + '( - 2 x + 2 ) * 2', + '( - 2 x + 2 ) ( 4 x + 2 )', + '( - 2 x + 2 ) ( - 2 x + 4 )', + '( - 2 x + 2 ) * 4', + '( - 2 x + 2 ) ( 2 x + 4 )', + '( - x + 2 ) ( - 2 x - 4 )', + '( - x + 2 ) * ( - 4 )', + '( - x + 2 ) ( 2 x - 4 )', + '( - x + 2 ) ( 4 x - 4 )', + '( - x + 2 ) ( - 4 x - 2 )', + '( - x + 2 ) * ( - 2 )', + '( - x + 2 ) ( 2 x - 2 )', + '( - x + 2 ) ( 4 x - 2 )', + '( - x + 2 ) * ( - 4 x )', + '( - x + 2 ) * ( - 2 x )', + '( - x + 2 ) * 2 x', + '( - x + 2 ) * 4 x', + '( - x + 2 ) ( - 4 x + 2 )', + '( - x + 2 ) ( - 2 x + 2 )', + '( - x + 2 ) * 2', + '( - x + 2 ) ( 4 x + 2 )', + '( - x + 2 ) ( - 4 x + 4 )', + '( - x + 2 ) * 4', + '( - x + 2 ) ( 2 x + 4 )', + '2 ( - 2 x - 4 )', + '2 * ( - 4 )', + '2 ( 2 x - 4 )', + '2 ( 4 x - 4 )', + '2 ( - 4 x - 2 )', + '2 * ( - 2 )', + '2 ( 2 x - 2 )', + '2 ( 4 x - 2 )', + '2 * ( - 4 x )', + '2 * ( - 2 x )', + '2 * 2 x', + '2 * 4 x', + '2 ( - 4 x + 2 )', + '2 ( - 2 x + 2 )', + '2 * 2', + '2 ( 4 x + 2 )', + '2 ( - 4 x + 4 )', + '2 ( - 2 x + 4 )', + '2 ( 2 x + 4 )', + '( x + 2 ) ( - 2 x - 4 )', + '( x + 2 ) * ( - 4 )', + '( x + 2 ) ( 2 x - 4 )', + '( x + 2 ) ( 4 x - 4 )', + '( x + 2 ) ( - 4 x - 2 )', + '( x + 2 ) * ( - 2 )', + '( x + 2 ) ( 2 x - 2 )', + '( x + 2 ) ( 4 x - 2 )', + '( x + 2 ) * ( - 4 x )', + '( x + 2 ) * ( - 2 x )', + '( x + 2 ) * 2 x', + '( x + 2 ) * 4 x', + '( x + 2 ) ( - 4 x + 2 )', + '( x + 2 ) ( - 2 x + 2 )', + '( x + 2 ) * 2', + '( x + 2 ) ( 4 x + 2 )', + '( x + 2 ) ( - 4 x + 4 )', + '( x + 2 ) ( - 2 x + 4 )', + '( x + 2 ) * 4'] diff --git a/pymath/calculus/test/test_arithmetic.py b/pymath/calculus/test/test_arithmetic.py index 435d96a..0e582ec 100644 --- a/pymath/calculus/test/test_arithmetic.py +++ b/pymath/calculus/test/test_arithmetic.py @@ -4,29 +4,29 @@ from pymath.calculus import arithmetic + def test_gcd_commu(): - assert arithmetic.gcd(3, 15) == arithmetic.gcd(15,3) + assert arithmetic.gcd(3, 15) == arithmetic.gcd(15, 3) + def test_gcd1(): assert arithmetic.gcd(3, 15) == 3 + def test_gcd2(): assert arithmetic.gcd(14, 21) == 7 + def test_gcd_prem(): assert arithmetic.gcd(14, 19) == 1 + def test_gcd_neg(): assert arithmetic.gcd(3, -15) == 3 assert arithmetic.gcd(-3, -15) == -3 - - - - # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del - diff --git a/pymath/calculus/test/test_expression.py b/pymath/calculus/test/test_expression.py index 2481b61..90a7f4f 100644 --- a/pymath/calculus/test/test_expression.py +++ b/pymath/calculus/test/test_expression.py @@ -14,38 +14,43 @@ def test_init_from_str(): exp = Expression("2 + 3") assert exp.postfix_tokens == [2, 3, "+"] + def test_init_from_exp(): pass + def test_init_list(): exp = Expression([2, 3, "+"]) assert exp.postfix_tokens == [2, 3, "+"] + def test_init_one_element_int_from_str(): exp = Expression("1") + def test_init_one_element_int_from_list(): exp = Expression([1]) -#def test_init_one_element_str_from_str(): +# def test_init_one_element_str_from_str(): # exp = Expression("x") # -#def test_init_one_element_str_from_list(): +# def test_init_one_element_str_from_list(): # exp = Expression(["x"]) + def test_simplify_exp(): exp = Expression("1 + 2 * 3") simplified = exp.simplify() ans = Expression("7") assert ans == simplified -#def test_simplify_frac(): +# def test_simplify_frac(): # exp = Expression("1/2 - 4") # simplified = exp.simplify() # ans = Expression("-7/2") # assert simplified == ans # -#def test_explain_frac(): +# def test_explain_frac(): # exp = Expression("1/2 - 4") # simplified = exp.simplify() # @@ -56,18 +61,21 @@ def test_simplify_exp(): # '\\frac{ -7 }{ 2 }'] # assert simplified.steps == list(exp.simplify()) + def test_add_exp(): e = Expression("12- 4") f = Expression("4 + 1") g = e + f assert g.postfix_tokens == [12, 4, '-', 4, 1, "+", "+"] + def test_mul_exp(): e = Expression("12- 4") f = Expression("4 + 1") g = e * f assert g.postfix_tokens == [12, 4, '-', 4, 1, "+", "*"] + def test_neg_exp(): e = Expression("12- 4") g = -e diff --git a/pymath/calculus/test/test_fraction.py b/pymath/calculus/test/test_fraction.py index 7e2b8c1..a789966 100644 --- a/pymath/calculus/test/test_fraction.py +++ b/pymath/calculus/test/test_fraction.py @@ -5,23 +5,33 @@ import unittest from pymath.calculus.fraction import Fraction + class TestFraction(unittest.TestCase): """Testing functions from pymath.calculus.Fraction""" def setUp(self): - self.listFrom = [Fraction(1,3), 1] - self.listAgainst = [ Fraction(1,3), \ - Fraction(2,3), \ - Fraction(4,5), \ - Fraction(-1, 3), \ - Fraction(1,-3), \ - 1, - ] + self.listFrom = [Fraction(1, 3), 1] + self.listAgainst = [Fraction(1, 3), + Fraction(2, 3), + Fraction(4, 5), + Fraction(-1, 3), + Fraction(1, -3), + 1, + ] def test_add(self): - ans = [[Fraction(2, 3), 1, Fraction(17, 15), 0, 0, Fraction(4,3)], \ - [Fraction(4,3), Fraction(5,3), Fraction(9,5), Fraction(2,3), Fraction(2,3), 2] \ - ] + ans = [ + [ + Fraction( + 2, 3), 1, Fraction( + 17, 15), 0, 0, Fraction( + 4, 3)], [ + Fraction( + 4, 3), Fraction( + 5, 3), Fraction( + 9, 5), Fraction( + 2, 3), Fraction( + 2, 3), 2]] for (i, f1) in enumerate(self.listFrom): for (j, f2) in enumerate(self.listAgainst): @@ -29,9 +39,9 @@ class TestFraction(unittest.TestCase): self.assertEqual(res, ans[i][j]) def test_sub(self): - ans = [[0, Fraction(-1,3), Fraction(-7, 15), Fraction(2,3), Fraction(2,3), Fraction(-2,3)], \ - [Fraction(2,3), Fraction(1,3), Fraction(1,5), Fraction(4,3), Fraction(4,3), 0] \ - ] + ans = [[0, Fraction(-1, 3), Fraction(-7, 15), Fraction(2, 3), Fraction(2, 3), Fraction(-2, 3)], + [Fraction(2, 3), Fraction(1, 3), Fraction(1, 5), Fraction(4, 3), Fraction(4, 3), 0] + ] for (i, f1) in enumerate(self.listFrom): for (j, f2) in enumerate(self.listAgainst): @@ -39,21 +49,20 @@ class TestFraction(unittest.TestCase): self.assertEqual(res, ans[i][j]) def test_neg(self): - ans = [ Fraction(-1,3), \ - Fraction(-2,3), \ - Fraction(-4,5), \ - Fraction(1, 3), \ - Fraction(1,3), \ - -1 - ] + ans = [Fraction(-1, 3), + Fraction(-2, 3), + Fraction(-4, 5), + Fraction(1, 3), + Fraction(1, 3), + -1 + ] for (j, f) in enumerate(self.listAgainst): res = -f self.assertEqual(res, ans[j]) def test_mul(self): - ans = [[Fraction(1, 9), Fraction(2,9), Fraction(4, 15), Fraction(-1,9), Fraction(-1,9), Fraction(1,3)], \ - [ Fraction(1,3), Fraction(2,3), Fraction(4,5), Fraction(-1, 3), Fraction(1,-3), 1] \ - ] + ans = [[Fraction(1, 9), Fraction(2, 9), Fraction(4, 15), Fraction(-1, 9), Fraction(-1, 9), Fraction( + 1, 3)], [Fraction(1, 3), Fraction(2, 3), Fraction(4, 5), Fraction(-1, 3), Fraction(1, -3), 1]] for (i, f1) in enumerate(self.listFrom): for (j, f2) in enumerate(self.listAgainst): @@ -61,9 +70,9 @@ class TestFraction(unittest.TestCase): self.assertEqual(res, ans[i][j]) def test_truediv(self): - ans = [[1, Fraction(1,2), Fraction(5, 12), -1, -1, Fraction(1,3)], \ - [3, Fraction(3,2), Fraction(5,4), -3, -3, 1] \ - ] + ans = [[1, Fraction(1, 2), Fraction(5, 12), -1, -1, Fraction(1, 3)], + [3, Fraction(3, 2), Fraction(5, 4), -3, -3, 1] + ] for (i, f1) in enumerate(self.listFrom): for (j, f2) in enumerate(self.listAgainst): diff --git a/pymath/calculus/test/test_generic.py b/pymath/calculus/test/test_generic.py index 57af8d9..ef730f1 100644 --- a/pymath/calculus/test/test_generic.py +++ b/pymath/calculus/test/test_generic.py @@ -6,14 +6,15 @@ import unittest from pymath.calculus import generic + class TestGeneric(unittest.TestCase): """Testing functions from pymath.calculus.generic""" def test_flatten_list1(self): - l = [1, [2,3], [[4,5], 6], 7] + l = [1, [2, 3], [[4, 5], 6], 7] flat_l = generic.flatten_list(l) - true_flat = list(range(1,8)) + true_flat = list(range(1, 8)) self.assertEqual(flat_l, true_flat) @@ -30,7 +31,7 @@ class TestGeneric(unittest.TestCase): l = range(10) first = generic.first_elem(l) - self.assertAlmostEqual(0,first) + self.assertAlmostEqual(0, first) s = "plopplop" first = generic.first_elem(s) @@ -38,7 +39,7 @@ class TestGeneric(unittest.TestCase): def test_first_elem_iter_in_iter(self): """ Interable in iterable """ - l = [[1,2],[4, 5, [6,7,8]], 9] + l = [[1, 2], [4, 5, [6, 7, 8]], 9] first = generic.first_elem(l) self.assertAlmostEqual(first, 1) @@ -53,12 +54,12 @@ class TestGeneric(unittest.TestCase): self.assertAlmostEqual(first, "a") - l = ["abc",[4, 5, [6,7,8]], 9] + l = ["abc", [4, 5, [6, 7, 8]], 9] first = generic.first_elem(l) self.assertAlmostEqual(first, "a") - l = [["abc",1],[4, 5, [6,7,8]], 9] + l = [["abc", 1], [4, 5, [6, 7, 8]], 9] first = generic.first_elem(l) self.assertAlmostEqual(first, "a") @@ -67,9 +68,6 @@ if __name__ == '__main__': unittest.main() - - - # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: diff --git a/pymath/calculus/test/test_operator.py b/pymath/calculus/test/test_operator.py index 89d173d..0fe305f 100644 --- a/pymath/calculus/test/test_operator.py +++ b/pymath/calculus/test/test_operator.py @@ -7,25 +7,29 @@ from pymath.calculus.operator import op # Test de op.add def test_add_render_tex(): - assert op.add.__tex__('1','2') == '1 + 2' - assert op.add.__tex__('1','-2') == '1 - 2' + assert op.add.__tex__('1', '2') == '1 + 2' + assert op.add.__tex__('1', '-2') == '1 - 2' + def test_add_render_txt(): - assert op.add.__txt__('1','2') == '1 + 2' - assert op.add.__txt__('1','-2') == '1 - 2' + assert op.add.__txt__('1', '2') == '1 + 2' + assert op.add.__txt__('1', '-2') == '1 - 2' # Test de op.sub + def test_sub_render_tex(): - assert op.sub.__tex__('1','2') == '1 - 2' - assert op.sub.__tex__('1','-2') == '1 - ( -2 )' + assert op.sub.__tex__('1', '2') == '1 - 2' + assert op.sub.__tex__('1', '-2') == '1 - ( -2 )' + def test_sub_render_txt(): - assert op.sub.__txt__('1','2') == '1 - 2' - assert op.sub.__txt__('1','-2') == '1 - ( -2 )' + assert op.sub.__txt__('1', '2') == '1 - 2' + assert op.sub.__txt__('1', '-2') == '1 - ( -2 )' # Test de op.sub1 + def test_sub1_render(): assert op.sub1.__tex__('1') == '- 1' assert op.sub1.__tex__('-1') == '- ( -1 )' @@ -33,56 +37,62 @@ def test_sub1_render(): assert op.sub1.__txt__('-1') == '- ( -1 )' # Test de op.mul + + def test_mul_render_tex(): - assert op.mul.__tex__('1','2') == '1 \\times 2' - assert op.mul.__tex__('1','-2') == '1 \\times ( -2 )' + assert op.mul.__tex__('1', '2') == '1 \\times 2' + assert op.mul.__tex__('1', '-2') == '1 \\times ( -2 )' + def test_mul_render_txt(): - assert op.mul.__txt__('1','2') == '1 * 2' - assert op.mul.__txt__('1','-2') == '1 * ( -2 )' + assert op.mul.__txt__('1', '2') == '1 * 2' + assert op.mul.__txt__('1', '-2') == '1 * ( -2 )' + def test_mul_is_visible(): - assert op.mul.is_visible(2,3) == True - assert op.mul.is_visible(2,-3) == True - assert op.mul.is_visible(-2,3) == True - assert op.mul.is_visible('a',2) == True - assert op.mul.is_visible('(2a + 1)', 2) == True - assert op.mul.is_visible(2, '(-2)') == True - assert op.mul.is_visible(2, '2a') == True - assert op.mul.is_visible(2, '(-2a)') == True - assert op.mul.is_visible(2, '(-2abc)') == True + assert op.mul.is_visible(2, 3) + assert op.mul.is_visible(2, -3) + assert op.mul.is_visible(-2, 3) + assert op.mul.is_visible('a', 2) + assert op.mul.is_visible('(2a + 1)', 2) + assert op.mul.is_visible(2, '(-2)') + assert op.mul.is_visible(2, '2a') + assert op.mul.is_visible(2, '(-2a)') + assert op.mul.is_visible(2, '(-2abc)') - assert op.mul.is_visible(2,'a') == False + assert op.mul.is_visible(2, 'a') == False assert op.mul.is_visible(2, '(2a + 1)') == False assert op.mul.is_visible('(3x - 1)', '(2a + 1)') == False assert op.mul.is_visible(2, '(-2x + 1)(3x + 2)') == False # Test de op.div + + def test_div_render_tex(): - assert op.div.__tex__('1','2') == '\\frac{ 1 }{ 2 }' - assert op.div.__tex__('1','-2') == '\\frac{ 1 }{ -2 }' + assert op.div.__tex__('1', '2') == '\\frac{ 1 }{ 2 }' + assert op.div.__tex__('1', '-2') == '\\frac{ 1 }{ -2 }' + def test_div_render_txt(): - assert op.div.__txt__('1','2') == '1 / 2' - assert op.div.__txt__('1','-2') == '1 / ( -2 )' + assert op.div.__txt__('1', '2') == '1 / 2' + assert op.div.__txt__('1', '-2') == '1 / ( -2 )' # Test de op.pw + + def test_pw_render_tex(): - assert op.pw.__tex__('1','2') == '1^{ 2 }' + assert op.pw.__tex__('1', '2') == '1^{ 2 }' #assert op.pw.__tex__('1','-2') == '1^{-2}' #assert op.pw.__tex__('-1','2') == '( -1 )^{ 2 }' + def test_pw_render_txt(): - assert op.pw.__txt__('1','2') == '1 ^ 2' - assert op.pw.__txt__('1','-2') == '1 ^ ( -2 )' + assert op.pw.__txt__('1', '2') == '1 ^ 2' + assert op.pw.__txt__('1', '-2') == '1 ^ ( -2 )' #assert op.pw.__txt__('-1','2') == '( -1 ) ^ 2 ' - - - # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del - diff --git a/pymath/calculus/test/test_polynom.py b/pymath/calculus/test/test_polynom.py index 70da7a1..04ef823 100644 --- a/pymath/calculus/test/test_polynom.py +++ b/pymath/calculus/test/test_polynom.py @@ -22,10 +22,10 @@ class TestPolynom(unittest.TestCase): def test_init_multi(self): p = Polynom([1, [2, 3], 4], "x") - #def test_init_arith(self): + # def test_init_arith(self): # p = Polynom([1, [2, 3, "+"], 4], "x") - #def test_init_arith_2(self): + # def test_init_arith_2(self): # p = Polynom([1, [[2, 3, "*"],3], 4], "x") def test_deg(self): @@ -45,66 +45,67 @@ class TestPolynom(unittest.TestCase): def test_eval_poly(self): p = Polynom([1, 2]) - self.assertEqual(p("h+1"), Polynom([3,2], "h")) + self.assertEqual(p("h+1"), Polynom([3, 2], "h")) - #def test_print(self): + # def test_print(self): # p = Polynom([1,2,3]) # ans = "1 + 2 x + 3 x^2" # self.assertEqual(ans, str(p)) - #def test_print_monom(self): + # def test_print_monom(self): # p = Polynom([0,2]) # ans = "2 x" # self.assertEqual(ans, str(p)) - #def test_print_0_coef(self): + # def test_print_0_coef(self): # p = Polynom([0,1,3]) # ans = "x + 3 x^2" # self.assertEqual(ans, str(p)) - #def test_print_multi_coef(self): + # def test_print_multi_coef(self): # p = Polynom([1,[2, -2],3]) # ans = "1 + 2 x - 2 x + 3 x^2" # self.assertEqual(ans, str(p)) def test_postfix(self): - p = Polynom([1,2,3]) + p = Polynom([1, 2, 3]) #ans = [1, 2, "x", "*", "+", 3, "x", 2, "^", "*", "+"] ans = [3, 'x', 2, '^', '*', 2, 'x', '*', '+', 1, '+'] self.assertEqual(ans, p.postfix_tokens) def test_postfix_monom(self): - p = Polynom([0,2]) + p = Polynom([0, 2]) ans = [2, "x", "*"] self.assertEqual(ans, p.postfix_tokens) def test_postfix_0_coef(self): - p = Polynom([0,2,0,4]) + p = Polynom([0, 2, 0, 4]) #ans = [2, "x", "*", 4, "x", 3, "^", "*", "+"] ans = [4, 'x', 3, '^', '*', 2, 'x', '*', '+'] self.assertEqual(ans, p.postfix_tokens) def test_postfix_1_coef(self): - p = Polynom([0,1,1]) + p = Polynom([0, 1, 1]) #ans = ["x", "x", 2, "^", "+"] ans = ["x", 2, "^", "x", "+"] self.assertEqual(ans, p.postfix_tokens) def test_postfix_neg_coef(self): - # TODO: Choix arbitraire (vis à vis des + et des -) il faudra faire en fonction de render |sam. juin 14 09:45:55 CEST 2014 - p = Polynom([-1,-2,-3]) + # TODO: Choix arbitraire (vis à vis des + et des -) il faudra faire en + # fonction de render |sam. juin 14 09:45:55 CEST 2014 + p = Polynom([-1, -2, -3]) #ans = [-1, -2, "x", "*", "+", -3, "x", 2, "^", "*", "+"] ans = [3, 'x', 2, '^', '*', '-', 2, 'x', '*', '-', 1, '-'] self.assertEqual(ans, p.postfix_tokens) def test_postfix_multi_coef(self): - p = Polynom([1,[2, 3],4]) + p = Polynom([1, [2, 3], 4]) #ans = [1, 2, "x", "*", "+", 3, "x", "*", "+", 4, "x", 2, "^", "*", "+"] ans = [4, 'x', 2, '^', '*', 2, 'x', '*', '+', 3, 'x', '*', '+', 1, '+'] self.assertEqual(ans, p.postfix_tokens) def test_postfix_arithm_coef(self): - p = Polynom([1,Expression([2, 3, "+"]),4]) + p = Polynom([1, Expression([2, 3, "+"]), 4]) #ans = [1, 2, 3, "+", "x", "*", "+", 4, "x", 2, "^", "*", "+"] ans = [4, 'x', 2, '^', '*', 2, 3, '+', 'x', '*', '+', 1, '+'] self.assertEqual(ans, p.postfix_tokens) @@ -115,7 +116,7 @@ class TestPolynom(unittest.TestCase): def test_reduce(self): p = Polynom([1, [2, 3], 4]) - ans = '4 x^{ 2 } + 5 x + 1' + ans = '4 x^{ 2 } + 5 x + 1' self.assertEqual(str(p.reduce()), ans) def test_add_int(self): @@ -129,7 +130,7 @@ class TestPolynom(unittest.TestCase): f = Fraction(1, 2) q = p + f ans = '3 x^{ 2 } + 2 x + \\frac{ 3 }{ 2 }' - self.assertEqual(str(q),ans) + self.assertEqual(str(q), ans) def test_add_poly(self): p = Polynom([1, 0, 3]) @@ -142,7 +143,7 @@ class TestPolynom(unittest.TestCase): p = Polynom([1, 2, 3]) q = p - 2 ans = '3 x^{ 2 } + 2 x - 1' - self.assertEqual(str(q),ans ) + self.assertEqual(str(q), ans) def test_sub_frac(self): p = Polynom([1, 2, 3]) @@ -159,31 +160,23 @@ class TestPolynom(unittest.TestCase): self.assertEqual(str(r), ans) def test_pow_monome(self): - p = Polynom([0,-2]) + p = Polynom([0, -2]) r = p**3 ans = '- 8 x^{ 3 }' self.assertEqual(str(r), ans) def test_pow2_monome(self): - p = Polynom([0,-2]) - r = p^3 + p = Polynom([0, -2]) + r = p ^ 3 ans = '- 8 x^{ 3 }' self.assertEqual(str(r), ans) - if __name__ == '__main__': unittest.main() - - - - - - # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del - diff --git a/pymath/calculus/test/test_polynomDeg2.py b/pymath/calculus/test/test_polynomDeg2.py index aa7c653..5670fba 100644 --- a/pymath/calculus/test/test_polynomDeg2.py +++ b/pymath/calculus/test/test_polynomDeg2.py @@ -7,7 +7,6 @@ import unittest from pymath.calculus.polynomDeg2 import Polynom_deg2 - class TestPolynomDeg2(unittest.TestCase): """Testing functions from pymath.calculus.polynomDeg2""" @@ -18,14 +17,7 @@ if __name__ == '__main__': unittest.main() - - - - - - # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del - diff --git a/pymath/calculus/test/test_random_expression.py b/pymath/calculus/test/test_random_expression.py index b8beba5..a417447 100644 --- a/pymath/calculus/test/test_random_expression.py +++ b/pymath/calculus/test/test_random_expression.py @@ -2,7 +2,6 @@ # encoding: utf-8 - from pymath.calculus.random_expression import RdExpression @@ -17,6 +16,7 @@ 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) @@ -28,6 +28,7 @@ def test_form_with_underscores(): 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) @@ -39,6 +40,7 @@ def test_only_form_calc(): assert set(rdExp._gene_varia.keys()), {'a' == 'b'} assert set(rdExp._gene_2replaced.keys()) == {'a+b'} + def test_only_form_cond(): form = "{a} + 2" cond = ["{a} == 3"] @@ -53,6 +55,7 @@ def test_only_form_cond(): assert rdExp._gene_varia['a'] == 3 + def test_only_form_conds(): form = "{a} + 2" cond = ["{a} in list(range(5))", "{a} % 2 == 1"] @@ -68,6 +71,7 @@ def test_only_form_conds(): assert rdExp._gene_varia['a'] in list(range(5)) assert rdExp._gene_varia['a'] % 2 == 1 + def test_only_form_calc_cond(): form = "{a*3} * {b}" cond = ["{a} == 3"] @@ -82,6 +86,7 @@ def test_only_form_calc_cond(): assert rdExp._gene_varia['a'] == 3 + def test_only_form_calc_cond_calc(): form = "{a*3} * {b}" cond = ["{a+b} == 3"] @@ -97,9 +102,7 @@ def test_only_form_calc_cond_calc(): assert (rdExp._gene_varia['a'] + rdExp._gene_varia['b']) == 3 - # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del - diff --git a/pymath/calculus/test/test_render.py b/pymath/calculus/test/test_render.py index edd85d3..f7ebc8b 100644 --- a/pymath/calculus/test/test_render.py +++ b/pymath/calculus/test/test_render.py @@ -4,7 +4,7 @@ import unittest -from pymath.calculus.render import tex, txt,p2i +from pymath.calculus.render import tex, txt, p2i from pymath.calculus.fraction import Fraction from pymath.calculus.polynom import Polynom from pymath.calculus.operator import op @@ -13,18 +13,20 @@ from pymath.calculus.expression import Expression from itertools import permutations -def mass_poly_test(operation, rg= 5): +def mass_poly_test(operation, rg=5): """ @todo :op: the operation :rg: number of potential values for coefs :returns: @todo """ - coefs_p = [[(i-2),(j-2)] for i,j in permutations(range(rg),2)] - coefs_q = [[2*(i-2),2*(j-2)] for i,j in permutations(range(rg),2)] + coefs_p = [[(i - 2), (j - 2)] for i, j in permutations(range(rg), 2)] + coefs_q = [[2 * (i - 2), 2 * (j - 2)] + for i, j in permutations(range(rg), 2)] l_p = [Polynom(i) for i in coefs_p] l_q = [Polynom(i) for i in coefs_q] - return [Expression([l_p[i],l_q[j],op.get_op(operation)]) for i,j in permutations(range(len(coefs_p)),2)] + return [Expression([l_p[i], l_q[j], op.get_op(operation)]) + for i, j in permutations(range(len(coefs_p)), 2)] class TestTexRender(unittest.TestCase): @@ -37,163 +39,165 @@ class TestTexRender(unittest.TestCase): self.assertEqual(tex(["a"]), "a") def test_type_render_fraction(self): - self.assertEqual(tex([Fraction(1,2)]), "\\frac{ 1 }{ 2 }") + self.assertEqual(tex([Fraction(1, 2)]), "\\frac{ 1 }{ 2 }") def test_type_render_poly(self): - P = Polynom([1,2,3]) + P = Polynom([1, 2, 3]) self.assertEqual(tex([P]), "3 x^{ 2 } + 2 x + 1") def test_add_interger(self): - exps = [ [2, 3, op.add ], - [2, -3, op.add ], - [-2, 3, op.add ], + exps = [[2, 3, op.add], + [2, -3, op.add], + [-2, 3, op.add], ] - wanted_render = [ "2 + 3", - "2 - 3", - "-2 + 3", - ] - for (i,e) in enumerate(exps): + wanted_render = ["2 + 3", + "2 - 3", + "-2 + 3", + ] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_mass_add(self): - permu = mass_poly_test("+",5) + permu = mass_poly_test("+", 5) from .mass_test import POLY_ADD_VALID_RESULTS - for (i,v) in enumerate(permu): + for (i, v) in enumerate(permu): self.assertEqual(tex(v), POLY_ADD_VALID_RESULTS[i]) def test_mass_sub(self): - permu = mass_poly_test("-",5) + permu = mass_poly_test("-", 5) from .mass_test import POLY_SUB_VALID_RESULTS - for (i,v) in enumerate(permu): + for (i, v) in enumerate(permu): self.assertEqual(tex(v), POLY_SUB_VALID_RESULTS[i]) def test_mass_mul(self): - permu = mass_poly_test("*",5) + permu = mass_poly_test("*", 5) from .mass_test import TEX_POLY_MUL_VALID_RESULTS - for (i,v) in enumerate(permu): + for (i, v) in enumerate(permu): self.assertEqual(tex(v), TEX_POLY_MUL_VALID_RESULTS[i]) def test_add_letter(self): - exps = [[2, "a", op.add ], - ["a", 3, op.add ], - [-2, "a", op.add ], - ["a", -2, op.add ], + exps = [[2, "a", op.add], + ["a", 3, op.add], + [-2, "a", op.add], + ["a", -2, op.add], ] - wanted_render = [ "2 + a", - "a + 3", - "-2 + a", - "a - 2", - ] - for (i,e) in enumerate(exps): + wanted_render = ["2 + a", + "a + 3", + "-2 + a", + "a - 2", + ] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_add_fraction(self): - exps = [[2, Fraction(1,2), op.add], - [Fraction(1,2), 3, op.add], + exps = [[2, Fraction(1, 2), op.add], + [Fraction(1, 2), 3, op.add], ] - wanted_render = [ "2 + \\frac{ 1 }{ 2 }", - "\\frac{ 1 }{ 2 } + 3", - ] - for (i,e) in enumerate(exps): + wanted_render = ["2 + \\frac{ 1 }{ 2 }", + "\\frac{ 1 }{ 2 } + 3", + ] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_add_poly(self): - exps = [[2, Polynom([1,2,3]), op.mul], - [Polynom([1,2,3]), 2, op.mul], - [Polynom([1,2,3]), Polynom([4,5,6]), op.mul], + exps = [[2, Polynom([1, 2, 3]), op.mul], + [Polynom([1, 2, 3]), 2, op.mul], + [Polynom([1, 2, 3]), Polynom([4, 5, 6]), op.mul], ] - wanted_render = [ "2 ( 3 x^{ 2 } + 2 x + 1 )", - "( 3 x^{ 2 } + 2 x + 1 ) \\times 2", - "( 3 x^{ 2 } + 2 x + 1 ) ( 6 x^{ 2 } + 5 x + 4 )", - ] - for (i,e) in enumerate(exps): + wanted_render = ["2 ( 3 x^{ 2 } + 2 x + 1 )", + "( 3 x^{ 2 } + 2 x + 1 ) \\times 2", + "( 3 x^{ 2 } + 2 x + 1 ) ( 6 x^{ 2 } + 5 x + 4 )", + ] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_mult_interger(self): - exps = [[2, 3, op.mul], + exps = [[2, 3, op.mul], [2, -3, op.mul], [-2, 3, op.mul], ] - wanted_render = [ "2 \\times 3", - "2 \\times ( -3 )", - "-2 \\times 3", - ] - for (i,e) in enumerate(exps): + wanted_render = ["2 \\times 3", + "2 \\times ( -3 )", + "-2 \\times 3", + ] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_mult_letter(self): - exps = [[2, "a", op.mul], - ["a", 3, op.mul], + exps = [[2, "a", op.mul], + ["a", 3, op.mul], [-2, "a", op.mul], ["a", -2, op.mul], ] - wanted_render = [ "2 a", "a \\times 3", "-2 a", "a \\times ( -2 )"] - for (i,e) in enumerate(exps): + wanted_render = ["2 a", "a \\times 3", "-2 a", "a \\times ( -2 )"] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_mult_fraction(self): - exps = [ [2, Fraction(1,2), op.mul], [Fraction(1,2), 3, op.mul]] - wanted_render = [ "2 \\times \\frac{ 1 }{ 2 }", "\\frac{ 1 }{ 2 } \\times 3"] - for (i,e) in enumerate(exps): + exps = [[2, Fraction(1, 2), op.mul], [Fraction(1, 2), 3, op.mul]] + wanted_render = [ + "2 \\times \\frac{ 1 }{ 2 }", + "\\frac{ 1 }{ 2 } \\times 3"] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_mult_poly(self): - exps = [[2, Polynom([1,2,3]), op.mul], - [Polynom([1,2,3]), 2, op.mul], - [Polynom([1,2,3]), Polynom([4,5,6]), op.mul], + exps = [[2, Polynom([1, 2, 3]), op.mul], + [Polynom([1, 2, 3]), 2, op.mul], + [Polynom([1, 2, 3]), Polynom([4, 5, 6]), op.mul], ] - wanted_render = [ "2 ( 3 x^{ 2 } + 2 x + 1 )", - "( 3 x^{ 2 } + 2 x + 1 ) \\times 2", - "( 3 x^{ 2 } + 2 x + 1 ) ( 6 x^{ 2 } + 5 x + 4 )", - ] - for (i,e) in enumerate(exps): + wanted_render = ["2 ( 3 x^{ 2 } + 2 x + 1 )", + "( 3 x^{ 2 } + 2 x + 1 ) \\times 2", + "( 3 x^{ 2 } + 2 x + 1 ) ( 6 x^{ 2 } + 5 x + 4 )", + ] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_parentheses_int(self): - exps = [\ - [ 2, 3, op.add, 4, op.mul],\ - [ 2, 3, op.mul, 4, op.add],\ - [ 2, 3, 4, op.mul, op.add],\ - [ 2, 3, 4, op.add, op.add],\ - [ 2, 3, 4, op.add, op.sub],\ - ] - wanted_render = [\ - '( 2 + 3 ) \\times 4',\ - '2 \\times 3 + 4',\ - '2 + 3 \\times 4',\ - '2 + 3 + 4',\ - '2 - ( 3 + 4 )',\ - ] - for (i,e) in enumerate(exps): + exps = [ + [2, 3, op.add, 4, op.mul], + [2, 3, op.mul, 4, op.add], + [2, 3, 4, op.mul, op.add], + [2, 3, 4, op.add, op.add], + [2, 3, 4, op.add, op.sub], + ] + wanted_render = [ + '( 2 + 3 ) \\times 4', + '2 \\times 3 + 4', + '2 + 3 \\times 4', + '2 + 3 + 4', + '2 - ( 3 + 4 )', + ] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) def test_parentheses_poly(self): - P = Polynom([1,2,3]) - Q = Polynom([4,5,6]) - exps = [\ - [ 2, P, op.add],\ - [ 2, P, op.sub],\ - [ 2, P, P, op.mul, op.sub],\ - [ Q, P, op.add],\ - [ Q, P, op.sub],\ - ] - wanted_render = [\ - '2 + 3 x^{ 2 } + 2 x + 1' ,\ - '2 - ( 3 x^{ 2 } + 2 x + 1 )' ,\ - '2 - ( 3 x^{ 2 } + 2 x + 1 ) ( 3 x^{ 2 } + 2 x + 1 )' ,\ - '6 x^{ 2 } + 5 x + 4 + 3 x^{ 2 } + 2 x + 1' ,\ - '6 x^{ 2 } + 5 x + 4 - ( 3 x^{ 2 } + 2 x + 1 )' ,\ - ] - for (i,e) in enumerate(exps): + P = Polynom([1, 2, 3]) + Q = Polynom([4, 5, 6]) + exps = [ + [2, P, op.add], + [2, P, op.sub], + [2, P, P, op.mul, op.sub], + [Q, P, op.add], + [Q, P, op.sub], + ] + wanted_render = [ + '2 + 3 x^{ 2 } + 2 x + 1', + '2 - ( 3 x^{ 2 } + 2 x + 1 )', + '2 - ( 3 x^{ 2 } + 2 x + 1 ) ( 3 x^{ 2 } + 2 x + 1 )', + '6 x^{ 2 } + 5 x + 4 + 3 x^{ 2 } + 2 x + 1', + '6 x^{ 2 } + 5 x + 4 - ( 3 x^{ 2 } + 2 x + 1 )', + ] + for (i, e) in enumerate(exps): rend = tex(e) self.assertEqual(rend, wanted_render[i]) @@ -201,8 +205,6 @@ class TestTexRender(unittest.TestCase): pass - - class TesttxtRender(unittest.TestCase): """Testing functions from pymath.calculus.renders.txt""" @@ -213,60 +215,60 @@ class TesttxtRender(unittest.TestCase): self.assertEqual(txt(["a"]), "a") def test_type_render_fraction(self): - self.assertEqual(txt([Fraction(1,2)]), "1 / 2") + self.assertEqual(txt([Fraction(1, 2)]), "1 / 2") def test_mult_interger(self): - exps = [ [2, 3, op.mul], \ - [2, -3, op.mul], \ + exps = [[2, 3, op.mul], + [2, -3, op.mul], [-2, 3, op.mul]] - wanted_render = [ "2 * 3", "2 * ( -3 )", "-2 * 3"] - for (i,e) in enumerate(exps): + wanted_render = ["2 * 3", "2 * ( -3 )", "-2 * 3"] + for (i, e) in enumerate(exps): rend = txt(e) self.assertEqual(rend, wanted_render[i]) def test_mult_letter(self): - exps = [ [2, "a", op.mul], \ - ["a", 3, op.mul], \ - [-2, "a", op.mul], \ + exps = [[2, "a", op.mul], + ["a", 3, op.mul], + [-2, "a", op.mul], ["a", -2, op.mul], ["a", -2, op.mul, -2, op.mul], ["a", -2, op.mul, "a", op.mul], ] - wanted_render = [ "2 a", - "a * 3", - "-2 a", - "a * ( -2 )", - "a * ( -2 ) * ( -2 )", - "a * ( -2 ) a", - ] - for (i,e) in enumerate(exps): + wanted_render = ["2 a", + "a * 3", + "-2 a", + "a * ( -2 )", + "a * ( -2 ) * ( -2 )", + "a * ( -2 ) a", + ] + for (i, e) in enumerate(exps): rend = txt(e) self.assertEqual(rend, wanted_render[i]) def test_mult_fraction(self): - exps = [ [2, Fraction(1,2), op.mul], \ - [Fraction(1,2), 3, op.mul]] - wanted_render = [ "2 * 1 / 2", "1 / 2 * 3"] - for (i,e) in enumerate(exps): + exps = [[2, Fraction(1, 2), op.mul], + [Fraction(1, 2), 3, op.mul]] + wanted_render = ["2 * 1 / 2", "1 / 2 * 3"] + for (i, e) in enumerate(exps): rend = txt(e) self.assertEqual(rend, wanted_render[i]) def test_parentheses(self): mul = op.get_op("*", 2) add = op.get_op("+", 2) - exps = [\ - [ 2, 3, add, 4, mul],\ - [ 2, 3, mul, 4, add],\ - [ 2, 3, 4, mul, add],\ - [ 2, 3, 4, add, add],\ - ] - wanted_render = [\ - '( 2 + 3 ) * 4',\ - '2 * 3 + 4',\ - '2 + 3 * 4',\ - '2 + 3 + 4',\ - ] - for (i,e) in enumerate(exps): + exps = [ + [2, 3, add, 4, mul], + [2, 3, mul, 4, add], + [2, 3, 4, mul, add], + [2, 3, 4, add, add], + ] + wanted_render = [ + '( 2 + 3 ) * 4', + '2 * 3 + 4', + '2 + 3 * 4', + '2 + 3 + 4', + ] + for (i, e) in enumerate(exps): rend = txt(e) self.assertEqual(rend, wanted_render[i]) @@ -274,21 +276,21 @@ class TesttxtRender(unittest.TestCase): pass def test_mass_add(self): - permu = mass_poly_test("+",5) + permu = mass_poly_test("+", 5) from .mass_test import POLY_ADD_VALID_RESULTS - for (i,v) in enumerate(permu): + for (i, v) in enumerate(permu): self.assertEqual(txt(v), POLY_ADD_VALID_RESULTS[i]) def test_mass_sub(self): - permu = mass_poly_test("-",5) + permu = mass_poly_test("-", 5) from .mass_test import POLY_SUB_VALID_RESULTS - for (i,v) in enumerate(permu): + for (i, v) in enumerate(permu): self.assertEqual(txt(v), POLY_SUB_VALID_RESULTS[i]) def test_mass_mul(self): - permu = mass_poly_test("*",5) + permu = mass_poly_test("*", 5) from .mass_test import TXT_POLY_MUL_VALID_RESULTS - for (i,v) in enumerate(permu): + for (i, v) in enumerate(permu): self.assertEqual(txt(v), TXT_POLY_MUL_VALID_RESULTS[i]) @@ -296,15 +298,7 @@ if __name__ == '__main__': unittest.main() - - - - - - - # ----------------------------- # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del - diff --git a/pymath/calculus/test/test_str2tokens.py b/pymath/calculus/test/test_str2tokens.py index cb7de0c..db26034 100644 --- a/pymath/calculus/test/test_str2tokens.py +++ b/pymath/calculus/test/test_str2tokens.py @@ -7,6 +7,7 @@ import unittest from pymath.calculus.str2tokens import str2tokens, str2in_tokens, in2post_fix from pymath.calculus.polynom import Polynom + class TestStr2tokens(unittest.TestCase): """Testing functions from pymath.calculus.str2tokens""" @@ -17,7 +18,6 @@ class TestStr2tokens(unittest.TestCase): ans = str2in_tokens("2*3+4") self.assertEqual(ans, [2, "*", 3, "+", 4]) - def test_in2post_fix(self): in_tokens = str2in_tokens("2+3*4") ans = in2post_fix(in_tokens) @@ -25,10 +25,10 @@ class TestStr2tokens(unittest.TestCase): in_tokens = str2in_tokens("2*3+4") ans = in2post_fix(in_tokens) - self.assertEqual(ans, [2, 3,"*", 4, "+"]) + self.assertEqual(ans, [2, 3, "*", 4, "+"]) - - # TODO: Ajouter des tests pour les cas particuliers... |sam. nov. 8 17:39:18 CET 2014 + # TODO: Ajouter des tests pour les cas particuliers... |sam. nov. 8 + # 17:39:18 CET 2014 def test_str2in_tokens_big_num(self): exp = "123 + 3" tok = str2in_tokens(exp) @@ -42,14 +42,13 @@ class TestStr2tokens(unittest.TestCase): def test_str2in_tokens_time_lack(self): exp = "(-3)(2)" tok = str2in_tokens(exp) - self.assertEqual(tok, ["(", -3, ")", "*","(", 2, ")" ]) + 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) @@ -58,12 +57,13 @@ class TestStr2tokens(unittest.TestCase): def test_str2tokens_poly(self): exp = "x(2+1) + 4" post = str2in_tokens(exp) - self.assertEqual(post, [Polynom([0, 1]), "*", "(", 2, "+", 1, ')', '+', 4]) + self.assertEqual(post, [Polynom([0, 1]), "*", + "(", 2, "+", 1, ')', '+', 4]) def test_str2in_tokens_time_lack2(self): exp = "-3(2)" tok = str2in_tokens(exp) - self.assertEqual(tok, [-3, "*","(", 2, ")" ]) + self.assertEqual(tok, [-3, "*", "(", 2, ")"]) def test_str2tokens_error_float(self): exp = "1 + 1.3" @@ -74,7 +74,6 @@ class TestStr2tokens(unittest.TestCase): self.assertRaises(ValueError, str2tokens, exp) - if __name__ == '__main__': unittest.main() @@ -83,4 +82,3 @@ if __name__ == '__main__': # Reglages pour 'vim' # vim:set autoindent expandtab tabstop=4 shiftwidth=4: # cursor: 16 del -