MCPcopy Index your code
hub / github.com/pywebio/PyWebIO / target

Function target

test/13.misc.py:20–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18
19
20def target():
21 # test session data
22 g = data()
23 assert g.none is None
24 g.one = 1
25 g.one += 1
26 assert g.one == 2
27
28 local.name = "Wang"
29 local.age = 22
30 assert len(local) == 3
31 assert local['age'] is local.age
32 assert local.foo is None
33 local[10] = "10"
34 del local['name']
35 del local.one
36
37 for key in local:
38 print(key)
39
40 assert 'bar' not in local
41 assert 'age' in local
42 assert local._dict == {'age': 22, 10: '10'}
43 print(local)
44
45 # test eval_js promise
46 import random
47 val = random.randint(1, 9999999)
48 promise_res = yield eval_js('''new Promise((resolve,reject) => {
49 setTimeout(() => {
50 resolve(val);
51 }, 1);
52 });''', val=val)
53 print(promise_res, val)
54 assert promise_res == val
55
56 # test pywebio.utils
57 async def corofunc(**kwargs):
58 pass
59
60 def genfunc(**kwargs):
61 yield
62
63 corofunc = partial(corofunc, a=1)
64 genfunc = partial(genfunc, a=1)
65
66 assert isgeneratorfunction(genfunc)
67 assert iscoroutinefunction(corofunc)
68 assert get_function_name(corofunc) == 'corofunc'
69
70 get_free_port()
71
72 try:
73 yield put_buttons([{'label': 'must not be shown'}], onclick=[lambda: None])
74 except Exception:
75 pass
76
77 put_table([

Callers 2

corobasedFunction · 0.70
threadbasedFunction · 0.70

Calls 15

dataFunction · 0.85
eval_jsFunction · 0.85
isgeneratorfunctionFunction · 0.85
iscoroutinefunctionFunction · 0.85
get_function_nameFunction · 0.85
get_free_portFunction · 0.85
put_buttonsFunction · 0.85
put_tableFunction · 0.85
popupFunction · 0.85
put_htmlFunction · 0.85
close_popupFunction · 0.85
use_scopeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…