Procházet zdrojové kódy

Fixed FIXME in unit tests using strategy.

Taddeus Kroes před 14 roky
rodič
revize
2eb3b7cb84
2 změnil soubory, kde provedl 9 přidání a 2 odebrání
  1. 5 0
      src/rules/precedences.py
  2. 4 2
      tests/test_rules_integrals.py

+ 5 - 0
src/rules/precedences.py

@@ -6,6 +6,9 @@ from .logarithmic import factor_in_exponent_multiplicant, \
 from .derivatives import chain_rule
 from .negation import double_negation, negated_factor, negated_nominator, \
         negated_denominator
+from .fractions import multiply_with_fraction
+from .integrals import factor_out_constant
+
 
 # Functions to move to the beginning of the possibilities list. Pairs of within
 # the list itself are compared by their position in the list: lower in the list
@@ -37,6 +40,8 @@ RELATIVE = [
         (expand_single, expand_double),
 
         (factor_out_exponent_important, raise_numerics),
+
+        (factor_out_constant, multiply_with_fraction)
         ]
 
 

+ 4 - 2
tests/test_rules_integrals.py

@@ -125,8 +125,10 @@ class TestRulesIntegrals(RulesTestCase):
         self.assertRewrite([
             'int a / x',
             'int a * 1 / x dx',
-            # FIXME: 'a int 1 / x dx',  # fix with strategy
-            # FIXME: 'aln|x| + c',
+            'aint 1 / x dx',
+            'a(ln|x| + c)',
+            'aln|x| + ac',
+            # FIXME: 'aln|x| + c',  # ac -> c
         ])
 
     def test_match_function_integral(self):