diff options
Diffstat (limited to 'test/expression/expression_helper.py')
| -rwxr-xr-x | test/expression/expression_helper.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/expression/expression_helper.py b/test/expression/expression_helper.py index 35873ca4..6c6fb2a9 100755 --- a/test/expression/expression_helper.py +++ b/test/expression/expression_helper.py @@ -1,6 +1,9 @@ #! /usr/bin/env python2 #-*- coding:utf-8 -*- +from __future__ import print_function + +from future.utils import viewitems import unittest @@ -25,13 +28,13 @@ class TestExpressionExpressionHelper(unittest.TestCase): vi = Variables_Identifier(exprf) # Use __str__ - print vi + print(vi) # Test the result new_expr = vi.equation ## Force replace in the variable dependency order - for var_id, var_value in reversed(vi.vars.items()): + for var_id, var_value in reversed(list(viewitems(vi.vars))): new_expr = new_expr.replace_expr({var_id: var_value}) self.assertEqual(exprf, new_expr) @@ -39,12 +42,12 @@ class TestExpressionExpressionHelper(unittest.TestCase): vi = Variables_Identifier(exprf, var_prefix="prefix_v") ## Use __str__ - print vi + print(vi) ## Test the result new_expr = vi.equation ### Force replace in the variable dependency order - for var_id, var_value in reversed(vi.vars.items()): + for var_id, var_value in reversed(list(viewitems(vi.vars))): new_expr = new_expr.replace_expr({var_id: var_value}) self.assertEqual(exprf, new_expr) @@ -55,7 +58,7 @@ class TestExpressionExpressionHelper(unittest.TestCase): ## Test the result new_expr = vi2.equation ### Force replace in the variable dependency order - for var_id, var_value in reversed(vi2.vars.items()): + for var_id, var_value in reversed(list(viewitems(vi2.vars))): new_expr = new_expr.replace_expr({var_id: var_value}) self.assertEqual(vi.equation, new_expr) @@ -72,7 +75,7 @@ class TestExpressionExpressionHelper(unittest.TestCase): ## Test the result new_expr = vi2.equation ### Force replace in the variable dependency order - for var_id, var_value in reversed(vi2.vars.items()): + for var_id, var_value in reversed(list(viewitems(vi2.vars))): new_expr = new_expr.replace_expr({var_id: var_value}) self.assertEqual(vi.equation, new_expr) |