From d142c48817f13bafa84658da4dc6f562f366f81a Mon Sep 17 00:00:00 2001 From: Kirill Smelkov Date: Fri, 25 Jul 2008 01:04:07 +0400 Subject: [PATCH] tests for .as_coeff_factors() one test fails (I think it's related to #946), but some tests are better than no tests at all. --- sympy/core/tests/test_basic.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sympy/core/tests/test_basic.py b/sympy/core/tests/test_basic.py index 0aa9272..d848fe8 100644 --- a/sympy/core/tests/test_basic.py +++ b/sympy/core/tests/test_basic.py @@ -3,6 +3,7 @@ from sympy import Basic, S, Symbol, Real, Integer, Rational, \ WildFunction, Poly, Function, Derivative, Number import py +from sympy.utilities.pytest import XFAIL class DummyNumber(object): """ @@ -512,6 +513,22 @@ def test_is_number(): assert (2*g).is_number == False + +# TODO write more tests for as_coeff_factors +def test_as_coeff_factors(): + x = Symbol('x') + + assert x .as_coeff_factors() == ( 0, (x,)) + assert (-1+x).as_coeff_factors() == (-1, (x,)) + assert ( 2+x).as_coeff_factors() == ( 2, (x,)) + +@XFAIL # as_coeff_factors assumes Number goes as first entry in Add.args +def test_as_coeff_factors_0(): + x = Symbol('x') + + assert ( 1+x).as_coeff_factors() == ( 1, (x,)) + + def test_as_coeff_exponent(): x, y = symbols("xy") assert (3*x**4).as_coeff_exponent(x) == (3, 4) -- 2.11.4.GIT