Implemented crisscross algorithm for solving LP problems.
[sympycore.git] / sympycore / tests / test_pickle.py
blobca8561e3cede698ab6e3c1e1b2c53c4c66cc69cc
2 import os
3 import tempfile
4 import pickle
6 from sympycore.core import Expr
7 from sympycore.utils import SYMBOL
9 class MyExpr(Expr):
10 # see comment in sympycore/core.py for pickling pure Expr
11 # instances.
12 pass
14 def test_pickle():
16 fn = tempfile.mktemp()
17 obj = MyExpr(SYMBOL, 'x')
19 f = open(fn, 'wb')
20 pickle.dump(obj, f)
21 f.close()
23 f = open(fn, 'rb')
24 obj2 = pickle.load(f)
25 f.close()
26 os.remove(fn)
28 assert obj.head == obj2.head,`obj.head, obj2.head`
29 assert obj.head is obj2.head,`obj.head, obj2.head, id(obj.head), id(obj2.head)`
30 assert obj.data == obj2.data,`obj.data, obj2.data`
31 assert obj.pair == obj2.pair,`obj.pair, obj2.pair`
32 assert obj==obj2,`obj,obj2`