##// END OF EJS Templates
Backport PR #5716: Add booktabs package to latex base.tplx...
Backport PR #5716: Add booktabs package to latex base.tplx Trivial fix to include the booktabs package in the base.tplx which is required for tables created with pandoc > 1.12.2 (see [releases](http://johnmacfarlane.net/pandoc/releases.html#pandoc-1.12.2-2013-12-07)) - fixes #5690

File last commit:

r16514:893691d8
r16630:29d3c96b
Show More
test_pickleutil.py
61 lines | 1.1 KiB | text/x-python | PythonLexer
import pickle
import nose.tools as nt
from IPython.utils import codeutil
from IPython.utils.pickleutil import can, uncan
def interactive(f):
f.__module__ = '__main__'
return f
def dumps(obj):
return pickle.dumps(can(obj))
def loads(obj):
return uncan(pickle.loads(obj))
def test_no_closure():
@interactive
def foo():
a = 5
return a
pfoo = dumps(foo)
bar = loads(pfoo)
nt.assert_equal(foo(), bar())
def test_generator_closure():
# this only creates a closure on Python 3
@interactive
def foo():
i = 'i'
r = [ i for j in (1,2) ]
return r
pfoo = dumps(foo)
bar = loads(pfoo)
nt.assert_equal(foo(), bar())
def test_nested_closure():
@interactive
def foo():
i = 'i'
def g():
return i
return g()
pfoo = dumps(foo)
bar = loads(pfoo)
nt.assert_equal(foo(), bar())
def test_closure():
i = 'i'
@interactive
def foo():
return i
# true closures are not supported
with nt.assert_raises(ValueError):
pfoo = dumps(foo)