Skip to content

Commit

Permalink
Merge pull request #645 from skirpichev/fix-pypy
Browse files Browse the repository at this point in the history
Fix pypy failures
  • Loading branch information
skirpichev committed Jun 13, 2018
2 parents 8512439 + 29742c3 commit bebcadf
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -67,6 +67,7 @@ matrix:
tags: true
allow_failures:
- python: pypy3.5
env: SPLIT=3/3
before_install:
- pip install --upgrade pip setuptools pytest codecov
install:
Expand Down
4 changes: 0 additions & 4 deletions diofant/core/expr.py
Expand Up @@ -495,10 +495,6 @@ def is_constant(self, *wrt, **flags):
return False
# try random real
b = expr._random(None, -1, 0, 1, 0)
if b is not None and b is not nan and b.equals(a) is False:
return False
# try random complex
b = expr._random()
if b is not None and b is not nan and b.equals(a) is False:
return False
failing_number = a if a.is_number else b
Expand Down
2 changes: 2 additions & 0 deletions diofant/core/tests/test_cache.py
@@ -1,3 +1,4 @@
import gc
import sys
import weakref

Expand Down Expand Up @@ -116,4 +117,5 @@ def test_sympyissue_8825():
assert sstr(list(ordered(d.items()))) == '[(a, 1), (b, 2)]'
del a
clear_cache()
gc.collect()
assert sstr(list(ordered(d.items()))) == '[(b, 2)]'
2 changes: 1 addition & 1 deletion diofant/domains/algebraicfield.py
Expand Up @@ -151,7 +151,7 @@ def __init__(self, rep):
else:
rep = [dom.convert(_) for _ in rep]

self.rep = dmp_strip(rep, 0)
self.rep = dmp_rem(dmp_strip(rep, 0), self.mod, 0, self.domain)

@property
def parent(self):
Expand Down
9 changes: 8 additions & 1 deletion diofant/domains/tests/test_domains.py
Expand Up @@ -775,6 +775,12 @@ def test_AlgebraicElement():
assert f.mod == mod
assert f.domain == QQ

f = A([QQ(3, 2)])

assert f.rep == [QQ(3, 2)]
assert f.mod == mod
assert f.domain == QQ

B = QQ.algebraic_field(I*sqrt(2))

a = A([QQ(1), QQ(1)])
Expand All @@ -800,7 +806,8 @@ def test_AlgebraicElement():
assert bool(A([QQ(1)])) is True

a = A([QQ(1), -QQ(1), QQ(2)])
assert a.LC() == 1
assert a.LC() == -1
assert a.rep == [-1, 1]

A = QQ.algebraic_field(root(2, 3))

Expand Down
2 changes: 1 addition & 1 deletion diofant/polys/tests/test_numberfields.py
Expand Up @@ -365,7 +365,7 @@ def test_field_isomorphism():

assert field_isomorphism(f, e) == [QQ(3, 80), 0, -QQ(139, 80), 0, QQ(347, 20), 0, -QQ(761, 20), -5]

assert field_isomorphism(QQ.algebraic_field(3), QQ.algebraic_field(sqrt(2))) == [1, 0]
assert field_isomorphism(QQ.algebraic_field(3), QQ.algebraic_field(sqrt(2))) == [3]

assert field_isomorphism(QQ.algebraic_field(+I*sqrt(3)), QQ.algebraic_field(I*sqrt(3)/2)) == [+1, 0]
assert field_isomorphism(QQ.algebraic_field(-I*sqrt(3)), QQ.algebraic_field(I*sqrt(3)/2)) == [-1, 0]
Expand Down
4 changes: 0 additions & 4 deletions diofant/vector/basisdependent.py
Expand Up @@ -182,8 +182,6 @@ def __new__(cls, *args, **options):

return obj

__init__ = Add.__init__


class BasisDependentMul(BasisDependent, Mul):
"""
Expand Down Expand Up @@ -242,8 +240,6 @@ def __new__(cls, *args, **options):

return obj

__init__ = Mul.__init__

def __str__(self, printer=None):
measure_str = self._measure_number.__str__()
if ('(' in measure_str or '-' in measure_str or
Expand Down

0 comments on commit bebcadf

Please sign in to comment.