Skip to content

Commit c0681b2

Browse files
committed
Skip a test on PyPy
1 parent 1562a4c commit c0681b2

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

symengine/tests/test_symbol.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from symengine import Symbol, symbols, symarray, has_symbol, Dummy
22
from symengine.utilities import raises
3+
import unittest
4+
import platform
35

46

57
def test_symbol():
@@ -8,9 +10,6 @@ def test_symbol():
810
assert str(x) == "x"
911
assert str(x) != "y"
1012
assert repr(x) == str(x)
11-
# Verify the successful use of slots.
12-
assert not hasattr(x, "__dict__")
13-
assert not hasattr(x, "__weakref__")
1413

1514

1615
def test_symbols():
@@ -163,6 +162,17 @@ def test_dummy():
163162
assert xdummy1 != xdummy2
164163
assert Dummy() != Dummy()
165164
assert Dummy('x') != Dummy('x')
165+
166+
# Cython cdef classes on PyPy has a __dict__ attribute always
167+
# __slots__ on PyPy are useless anyways. https://stackoverflow.com/a/23077685/4768820
168+
@unittest.skipUnless(platform.python_implementation()=="CPython", "__slots__ are useless on PyPy")
169+
def test_slots():
170+
x = Dummy('x')
166171
# Verify the successful use of slots.
167-
assert not hasattr(xdummy1, "__dict__")
168-
assert not hasattr(xdummy1, "__weakref__")
172+
assert not hasattr(x, "__dict__")
173+
assert not hasattr(x, "__weakref__")
174+
175+
x1 = Symbol('x')
176+
# Verify the successful use of slots.
177+
assert not hasattr(x, "__dict__")
178+
assert not hasattr(x, "__weakref__")

0 commit comments

Comments
 (0)