Commit f51ea5e3 authored by Taddeus Kroes's avatar Taddeus Kroes

Applied pep8 to unit tests.

parent c7a9125f
......@@ -44,10 +44,10 @@ class RulesTestCase(unittest.TestCase):
try:
for i, exp in enumerate(rewrite_chain[:-1]):
self.assertMultiLineEqual(str(rewrite(exp)),
str(rewrite_chain[i+1]))
str(rewrite_chain[i + 1]))
except AssertionError: # pragma: nocover
print 'rewrite failed: "%s" -> "%s"' \
% (str(exp), str(rewrite_chain[i+1]))
% (str(exp), str(rewrite_chain[i + 1]))
print 'rewrite chain index: %d' % i
print 'rewrite chain: ---'
......
......@@ -7,9 +7,4 @@ from tests.parser import ParserWrapper
class TestException(unittest.TestCase):
def test_raise(self):
try:
ParserWrapper(Parser).run(['raise'])
except RuntimeError:
return
raise AssertionError('Expected raised RuntimeError!') # pragma: nocover
self.assertRaises(RuntimeError, ParserWrapper(Parser).run, ['raise'])
......@@ -93,12 +93,13 @@ class TestRulesNumerics(RulesTestCase):
self.assertEqual(multiply_numerics(i3 * f2, (i3, f2, 3, 2.0)), 6.0)
self.assertEqual(multiply_numerics(f3 * f2, (f3, f2, 3.0, 2.0)), 6.0)
self.assertEqualNodes(multiply_numerics(a * i3 * i2 * b, (i3, i2, 3, 2)),
a * 6 * b)
self.assertEqualNodes(multiply_numerics(a * i3 * i2 * b,
(i3, i2, 3, 2)), a * 6 * b)
def test_multiply_numerics_negation(self):
l1_neg, l2 = root = tree('-1 * 2')
self.assertEqualNodes(multiply_numerics(root, (l1_neg, l2, -1, 2)), -l2)
self.assertEqualNodes(multiply_numerics(root, (l1_neg, l2, -1, 2)),
-l2)
root, l6 = tree('1 - 2 * 3,6')
l1, neg = root
......
......@@ -103,7 +103,8 @@ class TestRulesPowers(RulesTestCase):
a, p, q = tree('a,p,q')
n0, n1 = root = a ** p * a ** q
self.assertEqualNodes(add_exponents(root, (n0, n1, a, p, q)), a ** (p + q))
self.assertEqualNodes(add_exponents(root, (n0, n1, a, p, q)),
a ** (p + q))
def test_subtract_exponents(self):
a, p, q = tree('a,p,q')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment