##// END OF EJS Templates
Reverse hscrollbar min-height hack on OS X...
Reverse hscrollbar min-height hack on OS X OS X has optional behavior to only draw scrollbars during scroll, which causes problems for CodeMirror's scrollbars. CodeMirror's solution is to set a minimum size for their scrollbars, which is always present. The trade is that the container overlays most of the last line, swallowing click events when there is scrolling to do, even when no scrollbar is visible. This reverses the trade, recovering the click events at the expense of never showing the horizontal scrollbar on OS X when this option is enabled.

File last commit:

r16506:e56ff8b2
r20298:2907e856
Show More
test_pickleutil.py
61 lines | 1.1 KiB | text/x-python | PythonLexer
MinRK
handle simple closures in pickleutil...
r16506
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
pfoo = dumps(foo)
bar = loads(pfoo)
nt.assert_equal(foo(), bar())