##// 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:

r15517:aa339efe
r20298:2907e856
Show More
test_pickleshare.py
60 lines | 1.9 KiB | text/x-python | PythonLexer
from __future__ import print_function
import os
from unittest import TestCase
from IPython.testing.decorators import skip
from IPython.utils.tempdir import TemporaryDirectory
from IPython.utils.pickleshare import PickleShareDB
class PickleShareDBTestCase(TestCase):
def setUp(self):
self.tempdir = TemporaryDirectory()
def tearDown(self):
self.tempdir.cleanup()
def test_picklesharedb(self):
db = PickleShareDB(self.tempdir.name)
db.clear()
print("Should be empty:",db.items())
db['hello'] = 15
db['aku ankka'] = [1,2,313]
db['paths/nest/ok/keyname'] = [1,(5,46)]
db.hset('hash', 'aku', 12)
db.hset('hash', 'ankka', 313)
self.assertEqual(db.hget('hash','aku'), 12)
self.assertEqual(db.hget('hash','ankka'), 313)
print("all hashed",db.hdict('hash'))
print(db.keys())
print(db.keys('paths/nest/ok/k*'))
print(dict(db)) # snapsot of whole db
db.uncache() # frees memory, causes re-reads later
# shorthand for accessing deeply nested files
lnk = db.getlink('myobjects/test')
lnk.foo = 2
lnk.bar = lnk.foo + 5
self.assertEqual(lnk.bar, 7)
@skip("Too slow for regular running.")
def test_stress(self):
db = PickleShareDB('~/fsdbtest')
import time,sys
for i in range(1000):
for j in range(1000):
if i % 15 == 0 and i < 200:
if str(j) in db:
del db[str(j)]
continue
if j%33 == 0:
time.sleep(0.02)
db[str(j)] = db.get(str(j), []) + [(i,j,"proc %d" % os.getpid())]
db.hset('hash',j, db.hget('hash',j,15) + 1 )
print(i, end=' ')
sys.stdout.flush()
if i % 10 == 0:
db.uncache()