klongpy 0.6.9__py3-none-any.whl → 0.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. klongpy/__init__.py +19 -1
  2. klongpy/adverbs.py +5 -5
  3. klongpy/autograd.py +308 -0
  4. klongpy/backend.py +167 -99
  5. klongpy/backends/__init__.py +94 -0
  6. klongpy/backends/base.py +320 -0
  7. klongpy/backends/numpy_backend.py +122 -0
  8. klongpy/backends/torch_backend.py +995 -0
  9. klongpy-0.6.9.data/scripts/kgpy → klongpy/cli.py +65 -88
  10. klongpy/core.py +228 -108
  11. klongpy/db/sys_fn_db.py +4 -3
  12. klongpy/dyads.py +159 -28
  13. klongpy/interpreter.py +31 -3
  14. klongpy/monads.py +39 -3
  15. klongpy/repl.py +21 -3
  16. klongpy/sys_fn.py +128 -17
  17. klongpy/sys_fn_autograd.py +290 -0
  18. klongpy/sys_fn_ipc.py +18 -6
  19. klongpy/sys_fn_timer.py +13 -3
  20. klongpy/web/sys_fn_web.py +14 -4
  21. klongpy-0.7.0.dist-info/METADATA +493 -0
  22. klongpy-0.7.0.dist-info/RECORD +48 -0
  23. {klongpy-0.6.9.dist-info → klongpy-0.7.0.dist-info}/WHEEL +1 -1
  24. klongpy-0.7.0.dist-info/entry_points.txt +2 -0
  25. {klongpy-0.6.9.dist-info → klongpy-0.7.0.dist-info}/top_level.txt +0 -1
  26. klongpy-0.6.9.dist-info/METADATA +0 -448
  27. klongpy-0.6.9.dist-info/RECORD +0 -77
  28. tests/__init__.py +0 -6
  29. tests/gen_join_over.py +0 -119
  30. tests/gen_py_suite.py +0 -77
  31. tests/gen_test_fn.py +0 -259
  32. tests/perf_async.py +0 -25
  33. tests/perf_avg.py +0 -18
  34. tests/perf_duckdb.py +0 -32
  35. tests/perf_gen.py +0 -38
  36. tests/perf_ipc_overhead.py +0 -34
  37. tests/perf_join.py +0 -53
  38. tests/perf_load.py +0 -17
  39. tests/perf_prog.py +0 -18
  40. tests/perf_serdes.py +0 -52
  41. tests/perf_sys_fn_db.py +0 -263
  42. tests/perf_vector.py +0 -40
  43. tests/test_accel.py +0 -227
  44. tests/test_df_cache.py +0 -85
  45. tests/test_eval_monad_list.py +0 -34
  46. tests/test_examples.py +0 -64
  47. tests/test_extra_suite.py +0 -382
  48. tests/test_file_cache.py +0 -185
  49. tests/test_interop.py +0 -180
  50. tests/test_kg_asarray.py +0 -94
  51. tests/test_kgtests.py +0 -65
  52. tests/test_known_bugs.py +0 -206
  53. tests/test_prog.py +0 -107
  54. tests/test_reshape_strings.py +0 -33
  55. tests/test_suite.py +0 -1480
  56. tests/test_suite_file.py +0 -153
  57. tests/test_sys_fn.py +0 -420
  58. tests/test_sys_fn_db.py +0 -88
  59. tests/test_sys_fn_ipc.py +0 -587
  60. tests/test_sys_fn_timer.py +0 -133
  61. tests/test_sys_fn_web.py +0 -50
  62. tests/test_util.py +0 -233
  63. tests/utils.py +0 -126
  64. {klongpy-0.6.9.dist-info → klongpy-0.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,133 +0,0 @@
1
- import asyncio
2
- import threading
3
- import unittest
4
-
5
- from utils import kg_equal, LoopsBase
6
-
7
- from klongpy import KlongInterpreter
8
- from klongpy.sys_fn import *
9
-
10
-
11
- class TestSysFnTimer(LoopsBase, unittest.TestCase):
12
-
13
- def test_timer_return_0(self):
14
- klong = KlongInterpreter()
15
- klong['.system'] = {'ioloop': self.ioloop, 'klongloop': self.klongloop}
16
-
17
- async def _test():
18
- klong("result::0")
19
- klong('cb::{result::3;0}')
20
- klong('th::.timer("test";0;cb)')
21
-
22
- async def _test_result():
23
- r = klong("result")
24
- while r != 3:
25
- await asyncio.sleep(0)
26
- r = klong("result")
27
- self.assertEqual(r,3)
28
-
29
- task = self.klongloop.call_soon_threadsafe(asyncio.create_task, _test())
30
- asyncio.run_coroutine_threadsafe(_test_result(), self.klongloop).result()
31
-
32
- task.cancel()
33
-
34
-
35
- def test_timer_self_terminate(self):
36
- klong = KlongInterpreter()
37
- klong['.system'] = {'ioloop': self.ioloop, 'klongloop': self.klongloop}
38
-
39
- async def _test():
40
- klong("result::0")
41
- klong('cb::{result::result+1;result<2}')
42
- klong('th::.timer("test";0;cb)')
43
-
44
- async def _test_result():
45
- r = klong("result")
46
- self.assertTrue(r >= 0 and r < 3)
47
- while r != 2:
48
- await asyncio.sleep(0)
49
- r = klong("result")
50
- r = klong(".timerc(th)")
51
- self.assertEqual(r,0)
52
-
53
- task = self.klongloop.call_soon_threadsafe(asyncio.create_task, _test())
54
- asyncio.run_coroutine_threadsafe(_test_result(), self.klongloop).result()
55
- task.cancel()
56
-
57
- def test_timer_return_1_cancel(self):
58
- klong = KlongInterpreter()
59
- klong['.system'] = {'ioloop': self.ioloop, 'klongloop': self.klongloop}
60
-
61
- async def _test():
62
- klong("result::0")
63
- klong('cb::{result::result+1;1}')
64
- klong('th::.timer("test";0;cb)')
65
-
66
- async def _test_result():
67
- r = klong("result")
68
- self.assertTrue(r >= 0 and r < 3)
69
- while r != 2:
70
- await asyncio.sleep(0)
71
- r = klong("result")
72
- r = klong(".timerc(th)")
73
- self.assertEqual(r,1)
74
- r = klong(".timerc(th)")
75
- self.assertEqual(r,0)
76
-
77
- task = self.klongloop.call_soon_threadsafe(asyncio.create_task, _test())
78
- asyncio.run_coroutine_threadsafe(_test_result(), self.klongloop).result()
79
- task.cancel()
80
-
81
- def test_timer_1_sec_self_terminate(self):
82
- klong = KlongInterpreter()
83
- klong['.system'] = {'ioloop': self.ioloop, 'klongloop': self.klongloop}
84
-
85
- start_t = self.klongloop.time()
86
-
87
- async def _test():
88
- klong("result::0")
89
- klong('cb::{result::result+1;result<2}')
90
- klong('th::.timer("test";1;cb)')
91
-
92
- async def _test_result():
93
- r = klong("result")
94
- self.assertTrue(r >= 0 and r < 3)
95
- while r != 2:
96
- await asyncio.sleep(0)
97
- r = klong("result")
98
- delta_t = (self.klongloop.time() - start_t)
99
- self.assertTrue(delta_t >= 2)
100
- r = klong(".timerc(th)")
101
- self.assertEqual(r,0)
102
-
103
- task = self.klongloop.call_soon_threadsafe(asyncio.create_task, _test())
104
- asyncio.run_coroutine_threadsafe(_test_result(), self.klongloop).result()
105
- task.cancel()
106
-
107
- def test_timer_1_sec_cancel(self):
108
- klong = KlongInterpreter()
109
- klong['.system'] = {'ioloop': self.ioloop, 'klongloop': self.klongloop}
110
-
111
- start_t = self.klongloop.time()
112
-
113
- async def _test():
114
- klong("result::0")
115
- klong('cb::{result::result+1;1}')
116
- klong('th::.timer("test";1;cb)')
117
-
118
- async def _test_result():
119
- r = klong("result")
120
- self.assertTrue(r >= 0 and r < 3)
121
- while r != 2:
122
- await asyncio.sleep(0)
123
- r = klong("result")
124
- delta_t = (self.klongloop.time() - start_t)
125
- self.assertTrue(delta_t >= 2)
126
- r = klong(".timerc(th)")
127
- self.assertEqual(r,1)
128
- r = klong(".timerc(th)")
129
- self.assertEqual(r,0)
130
-
131
- task = self.klongloop.call_soon_threadsafe(asyncio.create_task, _test())
132
- asyncio.run_coroutine_threadsafe(_test_result(), self.klongloop).result()
133
- task.cancel()
tests/test_sys_fn_web.py DELETED
@@ -1,50 +0,0 @@
1
- import asyncio
2
- import socket
3
- import unittest
4
-
5
- import aiohttp
6
-
7
- from klongpy.repl import create_repl, cleanup_repl
8
-
9
-
10
- class TestSysFnWeb(unittest.TestCase):
11
- def setUp(self):
12
- self.klong, self.loops = create_repl()
13
- (self.ioloop, self.ioloop_thread, self.io_stop,
14
- self.klongloop, self.klongloop_thread, self.klong_stop) = self.loops
15
- self.handle = None
16
-
17
- def tearDown(self):
18
- if self.handle is not None and self.handle.task is not None:
19
- asyncio.run_coroutine_threadsafe(self.handle.shutdown(), self.ioloop).result()
20
- cleanup_repl(self.loops)
21
-
22
- def _free_port(self):
23
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
24
- s.bind(("", 0))
25
- port = s.getsockname()[1]
26
- s.close()
27
- return port
28
-
29
- def test_web_server_start_and_stop(self):
30
- klong = self.klong
31
- port = self._free_port()
32
-
33
- klong('.py("klongpy.web")')
34
- klong('index::{x;"hello"}')
35
- klong('get:::{}')
36
- klong('get,"/",index')
37
- klong('post:::{}')
38
- handle = klong(f'h::.web({port};get;post)')
39
- self.handle = handle
40
-
41
- async def fetch():
42
- async with aiohttp.ClientSession() as session:
43
- async with session.get(f"http://localhost:{port}/") as resp:
44
- return await resp.text()
45
-
46
- response = asyncio.run_coroutine_threadsafe(fetch(), self.ioloop).result()
47
- self.assertEqual(response, "hello")
48
-
49
- asyncio.run_coroutine_threadsafe(handle.shutdown(), self.ioloop).result()
50
-
tests/test_util.py DELETED
@@ -1,233 +0,0 @@
1
- import unittest
2
- from klongpy.core import *
3
- from utils import die, kg_equal
4
-
5
- class TestUtil(unittest.TestCase):
6
-
7
- def test_die(self):
8
- with self.assertRaises(RuntimeError):
9
- die("test")
10
-
11
- def test_read_shifted_comment(self):
12
- t = ':"hello"'
13
- i = 0
14
- i = read_shifted_comment(t,i+2)
15
- self.assertEqual(i,len(t))
16
-
17
- def test_read_shifted_comment_embedded(self):
18
- t = 'this is a :"hello" test'
19
- i = t.index(':"')+2
20
- i = read_shifted_comment(t,i)
21
- self.assertEqual(i,t.index(" test"))
22
-
23
- def test_read_shifted_comment_double_quote_embedded(self):
24
- t = 'this is a :"hello""world" test'
25
- i = t.index(':"')+2
26
- i = read_shifted_comment(t,i)
27
- self.assertEqual(i,t.index(" test"))
28
-
29
- def test_read_string(self):
30
- t = '"hello"'
31
- i = 0
32
- i,s = read_string(t,i+1)
33
- self.assertEqual(i,len(t))
34
- self.assertEqual(s,"hello")
35
-
36
- def test_read_substring(self):
37
- t = 'this is "hello" test'
38
- i = t.index('"')+1
39
- i,s = read_string(t,i)
40
- self.assertEqual(i,t.index(" test"))
41
- self.assertEqual(s,"hello")
42
-
43
- def test_read_quoted_substring(self):
44
- t = 'this is "hello""""world" test'
45
- i = t.index('"')+1
46
- i,s = read_string(t,i)
47
- self.assertEqual(i,t.index(" test"))
48
- self.assertEqual(s,'hello""world')
49
-
50
- def test_read_double_quoted_substring(self):
51
- t = 'this is "hello""""""world" test'
52
- i = t.index('"')+1
53
- i,s = read_string(t,i)
54
- self.assertEqual(i,t.index(" test"))
55
- self.assertEqual(s,'hello"""world')
56
-
57
- def test_read_empty_string(self):
58
- t = '""'
59
- i = 0
60
- i,s = read_string(t,i+1)
61
- self.assertEqual(i,len(t))
62
- self.assertEqual(s,'')
63
-
64
- def test_read_quoted_empty_string(self):
65
- t = '""""'
66
- i = 0
67
- i,s = read_string(t,i+1)
68
- self.assertEqual(i,len(t))
69
- # TODO: this seems like a bug in kg parsing strings since it starts on i+1
70
- self.assertEqual(s,'"')
71
-
72
- def test_read_double_quoted_empty_string(self):
73
- t = '""""""'
74
- i = 0
75
- i,s = read_string(t,i+1)
76
- self.assertEqual(i,len(t))
77
- # TODO: this seems like a bug in kg parsing strings since it starts on i+1
78
- self.assertEqual(s,'""')
79
-
80
-
81
- def test_read_quoted_embedded_string(self):
82
- t = '":["""";1;2]"'
83
- i = 0
84
- i,s = read_string(t,i+1)
85
- self.assertEqual(i,len(t))
86
- self.assertEqual(s,':["";1;2]')
87
-
88
- def test_embedded_string(self):
89
- t = '"A::""hello, world!"""'
90
- i = 0
91
- i,s = read_string(t,i+1)
92
- self.assertEqual(i,len(t))
93
- self.assertEqual(s,'A::"hello, world!"')
94
-
95
- def test_is_list(self):
96
- self.assertTrue(is_list([]))
97
- self.assertTrue(is_list(np.array([])))
98
- self.assertFalse(is_list(()))
99
- self.assertFalse(is_list(1))
100
- self.assertFalse(is_list(None))
101
-
102
- def test_is_iterable(self):
103
- self.assertTrue(is_iterable(""))
104
- self.assertTrue(is_iterable(''))
105
- self.assertTrue(is_iterable([]))
106
- self.assertFalse(is_iterable(None))
107
- self.assertFalse(is_iterable(1))
108
-
109
- def test_is_empty(self):
110
- self.assertTrue(is_empty(""))
111
- self.assertTrue(is_empty(''))
112
- self.assertTrue(is_empty([]))
113
- self.assertTrue(is_empty(np.array([])))
114
- self.assertFalse(is_empty(np.array([1])))
115
- self.assertFalse(is_empty([1]))
116
- self.assertFalse(is_empty(None))
117
- self.assertFalse(is_empty(1))
118
-
119
- def test_to_list(self):
120
- self.assertTrue(isinstance(to_list([]), list))
121
- self.assertEqual(to_list([]), [])
122
- self.assertTrue(isinstance(to_list(1), list))
123
- self.assertEqual(to_list([1]), [1])
124
- self.assertTrue(isinstance(to_list(np.array([])), list))
125
- self.assertEqual(to_list(np.array([])), [])
126
- self.assertTrue(isinstance(to_list(np.array([1])), list))
127
- self.assertEqual(to_list(np.array([1])), np.array([1]))
128
-
129
- def test_is_float(self, fn=is_float):
130
- self.assertFalse(fn(None))
131
- self.assertFalse(fn([]))
132
- self.assertFalse(fn([1]))
133
- self.assertFalse(fn({}))
134
- self.assertFalse(fn(""))
135
- self.assertFalse(fn("a"))
136
- self.assertFalse(fn("0"))
137
- self.assertFalse(fn("1"))
138
- self.assertFalse(fn("0.0"))
139
- self.assertFalse(fn("1.0"))
140
- self.assertTrue(fn(0))
141
- self.assertTrue(fn(1))
142
- self.assertTrue(fn(-1))
143
- self.assertTrue(fn(0.0))
144
- self.assertTrue(fn(-0.0))
145
- self.assertTrue(fn(1.0))
146
- self.assertTrue(fn(-1.0))
147
-
148
- def test_is_int(self, fn=is_integer, allow_floats=False):
149
- self.assertFalse(fn(None))
150
- self.assertFalse(fn([]))
151
- self.assertFalse(fn([1]))
152
- self.assertFalse(fn({}))
153
- self.assertFalse(fn(""))
154
- self.assertFalse(fn("a"))
155
- self.assertFalse(fn("0"))
156
- self.assertFalse(fn("1"))
157
- self.assertFalse(fn("0.0"))# if not allow_floats else self.assertTrue(fn("0.0"))
158
- self.assertFalse(fn("1.0"))# if not allow_floats else self.assertTrue(fn("1.0"))
159
- self.assertTrue(fn(0))
160
- self.assertTrue(fn(1))
161
- self.assertTrue(fn(-1))
162
- self.assertTrue(fn(0))
163
- self.assertTrue(fn(-0))
164
- self.assertTrue(fn(1))
165
- self.assertTrue(fn(-1))
166
-
167
- def test_is_number(self):
168
- self.test_is_float(fn=is_number)
169
- self.test_is_int(fn=is_number, allow_floats=True)
170
-
171
- def test_in_map(self):
172
- self.assertFalse(in_map(1,None))
173
- self.assertFalse(in_map(1,{}))
174
- self.assertTrue(in_map(1,{1:2}))
175
-
176
- def test_is_char(self):
177
- self.assertFalse(is_char(None))
178
- self.assertFalse(is_char(0))
179
- self.assertFalse(is_char([]))
180
- self.assertFalse(is_char({}))
181
- self.assertFalse(is_char(()))
182
- self.assertTrue(is_char(KGChar('1')))
183
- self.assertTrue(is_char(KGChar("1")))
184
- self.assertTrue(is_char(KGChar("-")))
185
- self.assertTrue(is_char(KGChar('a')))
186
- self.assertTrue(is_char(KGChar("a")))
187
- self.assertFalse(is_char("ab"))
188
-
189
- def test_cmatch(self):
190
- arr = "abc"
191
- self.assertFalse(cmatch(arr, 4, 'a'))
192
- [self.assertFalse(cmatch(arr, i, x)) for i,x in enumerate("def")]
193
- [self.assertTrue(cmatch(arr, i, x)) for i,x in enumerate(arr)]
194
-
195
- def test_cexpect(self):
196
- arr = "abc"
197
- with self.assertRaises(UnexpectedChar) as cm:
198
- cexpect(arr, 4, 'a')
199
- e = cm.exception
200
- self.assertEqual(e.args, ('t: abc pos: 4 char: a',))
201
- with self.assertRaises(UnexpectedChar):
202
- cexpect(arr, 0, 'e')
203
- for i,x in enumerate(arr):
204
- self.assertEqual(cexpect(arr, i, x), i+1)
205
-
206
- def test_safe_eq(self):
207
- self.assertFalse(safe_eq(1,[]))
208
- self.assertTrue(safe_eq(1,1))
209
-
210
- def test_merge_projections(self):
211
- self.assertEqual(merge_projections([]), [])
212
- self.assertEqual(merge_projections([[1]]), [1])
213
- self.assertTrue(np.equal(merge_projections([[10,20,30]]), [10,20,30]).all())
214
- self.assertTrue(np.equal(merge_projections([[10,None,None],[20,30]]), np.array([10,20,30])).all())
215
- self.assertTrue(np.equal(merge_projections([[10,None,None],[20,None],[30]]), np.array([10,20,30])).all())
216
-
217
- def test_is_adverb(self):
218
- a = ["'",':\\',":'",':/','/',':~',':*','\\','\\~','\\*']
219
- for x in a:
220
- self.assertTrue(is_adverb(x))
221
- self.assertFalse(is_adverb(":"))
222
- self.assertFalse(is_adverb("dog"))
223
-
224
- def test_argsort(self):
225
- a = [1,3,4,2]
226
- self.assertTrue(kg_equal(kg_argsort(a), [0, 3, 1, 2]))
227
- self.assertTrue(kg_equal(kg_argsort(a,descending=True), [2, 1, 3, 0]))
228
- a = [[1],[2],[],[3]]
229
- self.assertTrue(kg_equal(kg_argsort(a,descending=True), [3, 1, 0, 2]))
230
-
231
-
232
- if __name__ == '__main__':
233
- unittest.main()
tests/utils.py DELETED
@@ -1,126 +0,0 @@
1
- import asyncio
2
- import threading
3
- import time
4
-
5
- import numpy as np
6
-
7
- from klongpy import KlongInterpreter
8
- from klongpy.core import is_list, kg_equal
9
-
10
-
11
- def die(m=None):
12
- raise RuntimeError(m)
13
-
14
-
15
- def eval_cmp(expr_str, expected_str, klong=None):
16
- """
17
- Parse and execute both sides of a test.
18
- """
19
- klong = klong or KlongInterpreter()
20
- expr = klong.prog(expr_str)[1][0]
21
- expected = klong.prog(expected_str)[1][0]
22
- a = klong.call(expr)
23
- b = klong.call(expected)
24
- return kg_equal(a,b)
25
-
26
-
27
- def eval_test(a, klong=None):
28
- """
29
- To get the system going we need a way to test the t(x;y;z) methods before we can parse them.
30
- This test bootstraps the testing process via parsing the t() format.
31
- """
32
- klong = klong or create_test_klong()
33
- s = a[2:-1]
34
- i,p = klong.prog(s)
35
- if i != len(s):
36
- return False
37
- a = klong.call(p[1])
38
- b = klong.call(p[2])
39
- if np.isarray(a) and np.isarray(b):
40
- c = a == b
41
- return not c[np.where(c == False)].any() if np.isarray(c) else c
42
- else:
43
- return kg_equal(a,b)
44
-
45
-
46
- def create_test_klong():
47
- """
48
- Create a Klong instance that is similar to the Klong test suite,
49
- but modified to fail with die()
50
- """
51
- klong = KlongInterpreter()
52
- klong('err::0;')
53
- def fail(x,y,z):
54
- print(x,y,z)
55
- die()
56
- klong['fail'] = fail
57
- klong('t::{:[~y~z;fail(x;y;z);[]]}')
58
- klong('rnd::{:[x<0;-1;1]*_0.5+#x}')
59
- klong('rndn::{rnd(x*10^y)%10^y}')
60
- return klong
61
-
62
-
63
- def run_file(x, klong=None):
64
- with open(x, "r") as f:
65
- klong = klong or KlongInterpreter()
66
- return klong, klong(f.read())
67
-
68
-
69
- def rec_fn2(a,b,f):
70
- return np.asarray([rec_fn2(x, y, f) for x,y in zip(a,b)], dtype=object) if is_list(a) and is_list(b) else f(a,b)
71
-
72
-
73
- class LoopsBase:
74
- def setUp(self):
75
- # print("\nRunning test:", self._testMethodName)
76
-
77
- self.ioloop = asyncio.new_event_loop()
78
- self.ioloop.set_debug(True)
79
- self.ioloop_started = threading.Event()
80
-
81
- self.ioloop_thread = threading.Thread(target=self.start_ioloop)
82
- self.ioloop_thread.start()
83
- self.ioloop_started.wait()
84
- self.assertTrue(self.ioloop.is_running())
85
-
86
- self.klongloop = asyncio.new_event_loop()
87
- self.klongloop.set_debug(True)
88
- self.klongloop_started = threading.Event()
89
-
90
- self.klongloop_thread = threading.Thread(target=self.start_klongloop)
91
- self.klongloop_thread.start()
92
- self.klongloop_started.wait()
93
- self.assertTrue(self.klongloop.is_running())
94
-
95
- def tearDown(self):
96
- while len(asyncio.all_tasks(loop=self.ioloop)) > 0:
97
- time.sleep(0.1)
98
- self.ioloop.call_soon_threadsafe(self.ioloop.stop)
99
- self.ioloop_thread.join()
100
- self.ioloop.close()
101
-
102
- while len(asyncio.all_tasks(loop=self.klongloop)) > 0:
103
- time.sleep(0.1)
104
- self.klongloop.call_soon_threadsafe(self.klongloop.stop)
105
- self.klongloop_thread.join()
106
- self.klongloop.close()
107
-
108
- def start_ioloop(self):
109
- asyncio.set_event_loop(self.ioloop)
110
- self.ioloop.call_soon(self.ioloop_start_signal)
111
- self.ioloop.run_forever()
112
-
113
- def ioloop_start_signal(self):
114
- """Coroutine to set the event once the loop has started."""
115
- self.assertTrue(self.ioloop.is_running())
116
- self.ioloop_started.set()
117
-
118
- def start_klongloop(self):
119
- asyncio.set_event_loop(self.klongloop)
120
- self.klongloop.call_soon(self.klongloop_start_signal)
121
- self.klongloop.run_forever()
122
-
123
- def klongloop_start_signal(self):
124
- """Coroutine to set the event once the loop has started."""
125
- self.assertTrue(self.klongloop.is_running())
126
- self.klongloop_started.set()