Ver Fonte

More source code cleanup.

Taddeus Kroes há 14 anos atrás
pai
commit
8600bb1f79
2 ficheiros alterados com 8 adições e 10 exclusões
  1. 4 4
      src/rules/integrals.py
  2. 4 6
      tests/test_rules_integrals.py

+ 4 - 4
src/rules/integrals.py

@@ -72,8 +72,8 @@ def solve_integral(integral, F):
 
 def match_integrate_variable_power(node):
     """
-    int(x ^ n, x)  ->  x ^ (n + 1) / (n + 1) + c
-    int(g ^ x, x)  ->  g ^ x / ln(g)
+    int x ^ n dx  ->  x ^ (n + 1) / (n + 1) + c
+    int g ^ x dx  ->  g ^ x / ln(g)
     """
     assert node.is_op(OP_INT)
 
@@ -93,7 +93,7 @@ def match_integrate_variable_power(node):
 
 def integrate_variable_root(root, args):
     """
-    int(x ^ n, x)  ->  x ^ (n + 1) / (n + 1) + c
+    int x ^ n dx  ->  x ^ (n + 1) / (n + 1) + c
     """
     x, n = root[0]
 
@@ -106,7 +106,7 @@ MESSAGES[integrate_variable_root] = \
 
 def integrate_variable_exponent(root, args):
     """
-    int(g ^ x, x)  ->  g ^ x / ln(g)
+    int g ^ x dx  ->  g ^ x / ln(g)
     """
     g, x = root[0]
 

+ 4 - 6
tests/test_rules_integrals.py

@@ -35,11 +35,9 @@ class TestRulesIntegrals(RulesTestCase):
                     [P(root, integrate_variable_exponent)])
 
     def test_integrate_variable_root(self):
-        ((x, n), x), c = root, c = tree('int x ^ n, c')
-        self.assertEqual(integrate_variable_root(root, ()),
-                         x ** (n + 1) / (n + 1) + c)
+        root, expect = tree('int x ^ n, x ^ (n + 1) / (n + 1) + c')
+        self.assertEqual(integrate_variable_root(root, ()), expect)
 
     def test_integrate_variable_exponent(self):
-        ((g, x), x), c = root, c = tree('int g ^ x, c')
-        self.assertEqual(integrate_variable_exponent(root, ()),
-                         g ** x / ln(g) + c)
+        root, expect = tree('int g ^ x, g ^ x / ln(g) + c')
+        self.assertEqual(integrate_variable_exponent(root, ()), expect)