def from_sympy_list(cls, rep, lev, dom): """Create an instance of `cls` given a list of SymPy coefficients. """ return cls(dmp_from_sympy(rep, lev, dom), dom, lev)
def test_dmp_from_sympy(): assert dmp_from_sympy([[S(1), S(2)], [S(0)]], 1, ZZ) == \ [[ZZ(1), ZZ(2)], []] assert dmp_from_sympy([[S(1)/2, S(2)]], 1, QQ) == \ [[QQ(1, 2), QQ(2, 1)]]
def test_dmp_from_sympy(): assert dmp_from_sympy([[S.One, S(2)], [S.Zero]], 1, ZZ) == \ [[ZZ(1), ZZ(2)], []] assert dmp_from_sympy([[S.Half, S(2)]], 1, QQ) == \ [[QQ(1, 2), QQ(2, 1)]]