Navigation | Overlay |
---|---|
t Navigate files | h Toggle hits |
y Change url to tip of branch | m Toggle misses |
b / v Jump to prev/next hit line | p Toggle partial |
z / x Jump to prev/next missed or partial line | 1..9 Toggle flags |
shift + o Open current page in GitHub | a Toggle all on |
/ or ? Show keyboard shortcuts dialog | c Toggle context lines or commits |
1 | 6 |
from panel.pane import Ace |
2 |
|
|
3 | 6 |
code = """ |
4 |
import math
|
|
5 |
x = 10
|
|
6 |
math.sin(x)**2 + math.cos(x)**2 == 1
|
|
7 |
"""
|
|
8 |
|
|
9 |
|
|
10 | 6 |
def test_ace_pane(document, comm): |
11 | 6 |
pane = Ace(code) |
12 |
|
|
13 |
# Create pane
|
|
14 | 6 |
model = pane.get_root(document, comm=comm) |
15 | 6 |
assert pane._models[model.ref['id']][0] is model |
16 | 6 |
assert model.code == code |
17 |
|
|
18 |
# Replace Pane.object
|
|
19 | 6 |
pane.object = None |
20 | 6 |
assert pane._models[model.ref['id']][0] is model |
21 | 6 |
assert model.code == '' |
22 |
|
|
23 |
# Replace params
|
|
24 | 6 |
pane.object = "test" |
25 | 6 |
pane.language = 'xml' |
26 | 6 |
pane.theme = 'monokai' |
27 |
|
|
28 | 6 |
assert pane._models[model.ref['id']][0] is model |
29 | 6 |
assert model.code == "test" |
30 | 6 |
assert model.language == "xml" |
31 | 6 |
assert model.theme == "monokai" |
32 |
|
|
33 |
# Cleanup
|
|
34 | 6 |
pane._cleanup(model) |
35 | 6 |
assert pane._models == {} |
Read our documentation on viewing source code .