Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ install:

- set /p commit=<symengine_version.txt
- cd symengine-cpp
- git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"
- git fetch
- git checkout %commit%
- mkdir build
- cd build
Expand Down
2 changes: 2 additions & 0 deletions bin/test_symengine_unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export MAKEFLAGS="-j2"

git clone https://github.com/symengine/symengine symengine-cpp
cd symengine-cpp
git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'
git fetch
export SOURCE_DIR=`pwd`
git checkout `cat ../symengine_version.txt`
cd ..
Expand Down
13 changes: 13 additions & 0 deletions symengine/tests/test_pickling.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,33 @@ def __eq__(self, other):
return False
return self.name == other.name and self.attr == other.attr

def __ne__(self, other):
return not (self == other)

def __hash__(self, other):
return hash((self.__class__.__name__, self.name, self.attr))


class MySymbol(MySymbolBase):

def __reduce__(self):
return (self.__class__, (self.name, self.attr))


def test_pysymbol():
a = MySymbol("hello", attr=1)
b = pickle.loads(pickle.dumps(a + 2)) - 2
c = MySymbol("hello", attr=-1)
try:
assert a == b
assert type(a) == type(b)
assert a.attr == 1
assert b.attr == 1
assert b != c
finally:
a._unsafe_reset()
b._unsafe_reset()
c._unsafe_reset()

a = MySymbolBase("hello", attr=1)
try:
Expand Down
2 changes: 1 addition & 1 deletion symengine_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8a3bc848cd8246a4c15eee9bddc15de0d1157812
d10ee0be16d25f1e35d5cd31d6ac2788eb426833
Loading