jaclang 0.8.1__py3-none-any.whl → 0.8.3__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.

Potentially problematic release.


This version of jaclang might be problematic. Click here for more details.

Files changed (84) hide show
  1. jaclang/__init__.py +6 -0
  2. jaclang/cli/cli.py +21 -50
  3. jaclang/compiler/codeinfo.py +0 -1
  4. jaclang/compiler/constant.py +2 -0
  5. jaclang/compiler/jac.lark +17 -10
  6. jaclang/compiler/larkparse/jac_parser.py +2 -2
  7. jaclang/compiler/parser.py +34 -10
  8. jaclang/compiler/passes/main/__init__.py +2 -14
  9. jaclang/compiler/passes/main/annex_pass.py +2 -8
  10. jaclang/compiler/passes/main/cfg_build_pass.py +38 -12
  11. jaclang/compiler/passes/main/import_pass.py +3 -11
  12. jaclang/compiler/passes/main/pyast_gen_pass.py +246 -592
  13. jaclang/compiler/passes/main/sem_def_match_pass.py +67 -0
  14. jaclang/compiler/passes/main/sym_tab_build_pass.py +8 -0
  15. jaclang/compiler/passes/main/sym_tab_link_pass.py +2 -5
  16. jaclang/compiler/passes/main/tests/fixtures/sem_def_match.impl.jac +12 -0
  17. jaclang/compiler/passes/main/tests/fixtures/sem_def_match.jac +31 -0
  18. jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +2 -8
  19. jaclang/compiler/passes/main/tests/test_decl_impl_match_pass.py +7 -8
  20. jaclang/compiler/passes/main/tests/test_import_pass.py +5 -18
  21. jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +2 -6
  22. jaclang/compiler/passes/main/tests/test_sem_def_match_pass.py +38 -0
  23. jaclang/compiler/passes/main/tests/test_sub_node_pass.py +1 -3
  24. jaclang/compiler/passes/main/tests/test_sym_tab_link_pass.py +20 -17
  25. jaclang/compiler/passes/tool/doc_ir_gen_pass.py +259 -106
  26. jaclang/compiler/passes/tool/jac_formatter_pass.py +2 -0
  27. jaclang/compiler/passes/tool/tests/fixtures/archetype_frmt.jac +14 -0
  28. jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/triple_quoted_string.jac +5 -4
  29. jaclang/compiler/passes/tool/tests/fixtures/has_frmt.jac +13 -0
  30. jaclang/compiler/passes/tool/tests/fixtures/import_fmt.jac +6 -0
  31. jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +3 -3
  32. jaclang/compiler/passes/tool/tests/fixtures/tagbreak.jac +9 -0
  33. jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +25 -3
  34. jaclang/compiler/passes/tool/tests/test_unparse_validate.py +2 -2
  35. jaclang/compiler/program.py +23 -60
  36. jaclang/compiler/tests/fixtures/pkg_import_lib_py/__init__.py +2 -8
  37. jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/__init__.py +1 -5
  38. jaclang/compiler/tests/test_importer.py +10 -13
  39. jaclang/compiler/unitree.py +88 -16
  40. jaclang/langserve/__init__.jac +1 -1
  41. jaclang/langserve/engine.jac +113 -108
  42. jaclang/langserve/server.jac +17 -2
  43. jaclang/langserve/tests/server_test/test_lang_serve.py +138 -46
  44. jaclang/langserve/tests/server_test/utils.py +35 -9
  45. jaclang/langserve/tests/test_sem_tokens.py +1 -1
  46. jaclang/langserve/tests/test_server.py +3 -7
  47. jaclang/runtimelib/archetype.py +127 -5
  48. jaclang/runtimelib/importer.py +51 -94
  49. jaclang/runtimelib/machine.py +391 -268
  50. jaclang/runtimelib/meta_importer.py +86 -0
  51. jaclang/runtimelib/tests/fixtures/graph_purger.jac +24 -26
  52. jaclang/runtimelib/tests/fixtures/other_root_access.jac +25 -16
  53. jaclang/runtimelib/tests/test_jaseci.py +3 -1
  54. jaclang/tests/fixtures/arch_rel_import_creation.jac +23 -23
  55. jaclang/tests/fixtures/async_ability.jac +43 -10
  56. jaclang/tests/fixtures/async_function.jac +18 -0
  57. jaclang/tests/fixtures/async_walker.jac +17 -12
  58. jaclang/tests/fixtures/create_dynamic_archetype.jac +25 -28
  59. jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +7 -4
  60. jaclang/tests/fixtures/deep/deeper/snd_lev.jac +2 -2
  61. jaclang/tests/fixtures/deep/deeper/snd_lev_dup.jac +6 -0
  62. jaclang/tests/fixtures/deep/one_lev.jac +2 -2
  63. jaclang/tests/fixtures/deep/one_lev_dup.jac +4 -3
  64. jaclang/tests/fixtures/dynamic_archetype.jac +19 -12
  65. jaclang/tests/fixtures/foo.jac +14 -22
  66. jaclang/tests/fixtures/jac_from_py.py +1 -1
  67. jaclang/tests/fixtures/jp_importer.jac +6 -6
  68. jaclang/tests/fixtures/jp_importer_auto.jac +5 -3
  69. jaclang/tests/fixtures/unicode_strings.jac +24 -0
  70. jaclang/tests/fixtures/walker_update.jac +5 -7
  71. jaclang/tests/test_language.py +138 -140
  72. jaclang/tests/test_reference.py +9 -4
  73. jaclang/tests/test_typecheck.py +13 -26
  74. jaclang/utils/lang_tools.py +7 -5
  75. jaclang/utils/module_resolver.py +23 -0
  76. {jaclang-0.8.1.dist-info → jaclang-0.8.3.dist-info}/METADATA +1 -1
  77. {jaclang-0.8.1.dist-info → jaclang-0.8.3.dist-info}/RECORD +79 -72
  78. jaclang/compiler/passes/main/tests/fixtures/main_err.jac +0 -6
  79. jaclang/compiler/passes/main/tests/fixtures/second_err.jac +0 -4
  80. jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +0 -644
  81. jaclang/compiler/passes/tool/tests/test_doc_ir_gen_pass.py +0 -29
  82. jaclang/tests/fixtures/deep/deeper/__init__.jac +0 -1
  83. {jaclang-0.8.1.dist-info → jaclang-0.8.3.dist-info}/WHEEL +0 -0
  84. {jaclang-0.8.1.dist-info → jaclang-0.8.3.dist-info}/entry_points.txt +0 -0
@@ -5,11 +5,12 @@ import os
5
5
  import sys
6
6
  import sysconfig
7
7
  import tempfile
8
+ import subprocess
9
+ from pathlib import Path
8
10
  from unittest.mock import patch
9
11
 
10
- from jaclang import JacMachineInterface as Jac, JacMachine
12
+ from jaclang import JacMachine as Jac
11
13
  from jaclang.cli import cli
12
- from jaclang.compiler.passes.main import CompilerMode as CMode
13
14
  from jaclang.compiler.program import JacProgram
14
15
  from jaclang.utils.test import TestCase
15
16
 
@@ -19,15 +20,16 @@ class JacLanguageTests(TestCase):
19
20
 
20
21
  def setUp(self) -> None:
21
22
  """Set up test."""
22
- self.mach = JacMachine(self.fixture_abs_path("./"))
23
+ Jac.reset_machine()
24
+ Jac.set_base_path(self.fixture_abs_path("./"))
23
25
  Jac.attach_program(
24
- self.mach,
25
26
  JacProgram(),
26
27
  )
27
28
  return super().setUp()
28
29
 
29
30
  def tearDown(self) -> None:
30
31
  """Tear down test."""
32
+ Jac.reset_machine()
31
33
  return super().tearDown()
32
34
 
33
35
  def test_sub_abilities(self) -> None:
@@ -69,7 +71,6 @@ class JacLanguageTests(TestCase):
69
71
  captured_output = io.StringIO()
70
72
  sys.stdout = captured_output
71
73
  Jac.jac_import(
72
- self.mach,
73
74
  "micro.simple_walk",
74
75
  base_path=self.examples_abs_path(""),
75
76
  override_name="__main__",
@@ -87,7 +88,7 @@ class JacLanguageTests(TestCase):
87
88
  captured_output = io.StringIO()
88
89
  sys.stdout = captured_output
89
90
  Jac.jac_import(
90
- self.mach, "micro.simple_walk_by_edge", base_path=self.examples_abs_path("")
91
+ "micro.simple_walk_by_edge", base_path=self.examples_abs_path("")
91
92
  )
92
93
  sys.stdout = sys.__stdout__
93
94
  stdout_value = captured_output.getvalue()
@@ -100,7 +101,7 @@ class JacLanguageTests(TestCase):
100
101
  """Parse micro jac file."""
101
102
  captured_output = io.StringIO()
102
103
  sys.stdout = captured_output
103
- Jac.jac_import(self.mach, "guess_game", base_path=self.fixture_abs_path("./"))
104
+ Jac.jac_import("guess_game", base_path=self.fixture_abs_path("./"))
104
105
  sys.stdout = sys.__stdout__
105
106
  stdout_value = captured_output.getvalue()
106
107
  self.assertEqual(
@@ -114,9 +115,7 @@ class JacLanguageTests(TestCase):
114
115
 
115
116
  captured_output = io.StringIO()
116
117
  sys.stdout = captured_output
117
- Jac.jac_import(
118
- self.mach, "builtin_printgraph_json", base_path=self.fixture_abs_path("./")
119
- )
118
+ Jac.jac_import("builtin_printgraph_json", base_path=self.fixture_abs_path("./"))
120
119
  sys.stdout = sys.__stdout__
121
120
  stdout_value = captured_output.getvalue()
122
121
  data = json.loads(stdout_value)
@@ -135,7 +134,6 @@ class JacLanguageTests(TestCase):
135
134
  captured_output = io.StringIO()
136
135
  sys.stdout = captured_output
137
136
  Jac.jac_import(
138
- self.mach,
139
137
  "builtin_printgraph_mermaid",
140
138
  base_path=self.fixture_abs_path("./"),
141
139
  )
@@ -147,7 +145,7 @@ class JacLanguageTests(TestCase):
147
145
  """Parse micro jac file."""
148
146
  captured_output = io.StringIO()
149
147
  sys.stdout = captured_output
150
- Jac.jac_import(self.mach, "chandra_bugs", base_path=self.fixture_abs_path("./"))
148
+ Jac.jac_import("chandra_bugs", base_path=self.fixture_abs_path("./"))
151
149
  sys.stdout = sys.__stdout__
152
150
  stdout_value = captured_output.getvalue()
153
151
  self.assertEqual(
@@ -159,9 +157,7 @@ class JacLanguageTests(TestCase):
159
157
  """Parse micro jac file."""
160
158
  captured_output = io.StringIO()
161
159
  sys.stdout = captured_output
162
- Jac.jac_import(
163
- self.mach, "chandra_bugs2", base_path=self.fixture_abs_path("./")
164
- )
160
+ Jac.jac_import("chandra_bugs2", base_path=self.fixture_abs_path("./"))
165
161
  sys.stdout = sys.__stdout__
166
162
  stdout_value = captured_output.getvalue()
167
163
  self.assertEqual(
@@ -176,7 +172,7 @@ class JacLanguageTests(TestCase):
176
172
  """Parse micro jac file."""
177
173
  captured_output = io.StringIO()
178
174
  sys.stdout = captured_output
179
- Jac.jac_import(self.mach, "ignore_dup", base_path=self.fixture_abs_path("./"))
175
+ Jac.jac_import("ignore_dup", base_path=self.fixture_abs_path("./"))
180
176
  sys.stdout = sys.__stdout__
181
177
  stdout_value = captured_output.getvalue()
182
178
  self.assertEqual(stdout_value.split("\n")[0].count("here"), 10)
@@ -186,16 +182,16 @@ class JacLanguageTests(TestCase):
186
182
  """Parse micro jac file."""
187
183
  captured_output = io.StringIO()
188
184
  sys.stdout = captured_output
189
- Jac.jac_import(
190
- self.mach, "hashcheck_dup", base_path=self.fixture_abs_path("./")
191
- )
185
+ Jac.jac_import("hashcheck_dup", base_path=self.fixture_abs_path("./"))
192
186
  sys.stdout = sys.__stdout__
193
187
  stdout_value = captured_output.getvalue()
194
188
  self.assertEqual(stdout_value.count("check"), 2)
195
189
 
196
190
  def test_arith_precedence(self) -> None:
197
191
  """Basic precedence test."""
198
- prog = JacProgram().compile_from_str("with entry {print(4-5-4);}", "test.jac")
192
+ prog = JacProgram().compile(
193
+ use_str="with entry {print(4-5-4);}", file_path="test.jac"
194
+ )
199
195
  captured_output = io.StringIO()
200
196
  sys.stdout = captured_output
201
197
  exec(compile(prog.gen.py_ast[0], "test.py", "exec"))
@@ -207,7 +203,7 @@ class JacLanguageTests(TestCase):
207
203
  """Test importing python."""
208
204
  captured_output = io.StringIO()
209
205
  sys.stdout = captured_output
210
- Jac.jac_import(self.mach, "needs_import", base_path=self.fixture_abs_path("./"))
206
+ Jac.jac_import("needs_import", base_path=self.fixture_abs_path("./"))
211
207
  sys.stdout = sys.__stdout__
212
208
  stdout_value = captured_output.getvalue()
213
209
  self.assertIn("<module 'pyfunc' from", stdout_value)
@@ -217,7 +213,6 @@ class JacLanguageTests(TestCase):
217
213
  captured_output = io.StringIO()
218
214
  sys.stdout = captured_output
219
215
  Jac.jac_import(
220
- self.mach,
221
216
  "reference.special_comprehensions",
222
217
  base_path=self.examples_abs_path(""),
223
218
  )
@@ -229,9 +224,7 @@ class JacLanguageTests(TestCase):
229
224
  """Test the dot gen of nodes and edges of bubblesort."""
230
225
  captured_output = io.StringIO()
231
226
  sys.stdout = captured_output
232
- Jac.jac_import(
233
- self.mach, "gendot_bubble_sort", base_path=self.fixture_abs_path("./")
234
- )
227
+ Jac.jac_import("gendot_bubble_sort", base_path=self.fixture_abs_path("./"))
235
228
  sys.stdout = sys.__stdout__
236
229
  stdout_value = captured_output.getvalue()
237
230
  self.assertIn(
@@ -243,9 +236,7 @@ class JacLanguageTests(TestCase):
243
236
  """Test assign_compr."""
244
237
  captured_output = io.StringIO()
245
238
  sys.stdout = captured_output
246
- Jac.jac_import(
247
- self.mach, "assign_compr_dup", base_path=self.fixture_abs_path("./")
248
- )
239
+ Jac.jac_import("assign_compr_dup", base_path=self.fixture_abs_path("./"))
249
240
  sys.stdout = sys.__stdout__
250
241
  stdout_value = captured_output.getvalue()
251
242
  self.assertEqual(
@@ -257,9 +248,7 @@ class JacLanguageTests(TestCase):
257
248
  """Test raw string and byte string."""
258
249
  captured_output = io.StringIO()
259
250
  sys.stdout = captured_output
260
- Jac.jac_import(
261
- self.mach, "raw_byte_string", base_path=self.fixture_abs_path("./")
262
- )
251
+ Jac.jac_import("raw_byte_string", base_path=self.fixture_abs_path("./"))
263
252
  sys.stdout = sys.__stdout__
264
253
  stdout_value = captured_output.getvalue()
265
254
  self.assertEqual(stdout_value.count(r"\\\\"), 2)
@@ -270,7 +259,6 @@ class JacLanguageTests(TestCase):
270
259
  captured_output = io.StringIO()
271
260
  sys.stdout = captured_output
272
261
  Jac.jac_import(
273
- self.mach,
274
262
  "compiler/passes/main/tests/fixtures/fstrings",
275
263
  base_path=self.fixture_abs_path("../../"),
276
264
  )
@@ -286,36 +274,30 @@ class JacLanguageTests(TestCase):
286
274
  captured_output = io.StringIO()
287
275
  sys.stdout = captured_output
288
276
 
289
- Jac.jac_import(self.mach, "deep_import", base_path=self.fixture_abs_path("./"))
277
+ Jac.jac_import("deep_import", base_path=self.fixture_abs_path("./"))
290
278
  sys.stdout = sys.__stdout__
291
279
  stdout_value = captured_output.getvalue()
292
- print(self.mach.loaded_modules.keys())
293
280
  self.assertEqual(stdout_value.split("\n")[0], "one level deeperslHello World!")
294
281
 
295
282
  def test_deep_imports_interp_mode(self) -> None:
296
283
  """Parse micro jac file."""
297
- mach = JacMachine(self.fixture_abs_path("./"))
284
+ Jac.set_base_path(self.fixture_abs_path("./"))
298
285
  Jac.attach_program(
299
- mach,
300
286
  JacProgram(),
301
287
  )
302
- Jac.jac_import(
303
- mach, "deep_import_interp", base_path=self.fixture_abs_path("./")
304
- )
305
- self.assertEqual(len(mach.program.mod.hub.keys()), 1)
306
- mach = JacMachine(self.fixture_abs_path("./"))
288
+ Jac.jac_import("deep_import_interp", base_path=self.fixture_abs_path("./"))
289
+ self.assertEqual(len(Jac.program.mod.hub.keys()), 1)
290
+ Jac.set_base_path(self.fixture_abs_path("./"))
307
291
  Jac.attach_program(
308
- mach,
309
292
  (prog := JacProgram()),
310
293
  )
311
- prog.compile(self.fixture_abs_path("./deep_import_interp.jac"))
312
- Jac.jac_import(
313
- mach, "deep_import_interp", base_path=self.fixture_abs_path("./")
314
- )
315
- self.assertEqual(len(mach.program.mod.hub.keys()), 5)
294
+ prog.build(self.fixture_abs_path("./deep_import_interp.jac"))
295
+ Jac.jac_import("deep_import_interp", base_path=self.fixture_abs_path("./"))
296
+ self.assertEqual(len(Jac.program.mod.hub.keys()), 5)
316
297
 
317
298
  def test_deep_imports_mods(self) -> None:
318
299
  """Parse micro jac file."""
300
+ Jac.reset_machine()
319
301
  targets = [
320
302
  "deep",
321
303
  "deep.deeper",
@@ -326,20 +308,19 @@ class JacLanguageTests(TestCase):
326
308
  for i in targets:
327
309
  if i in sys.modules:
328
310
  del sys.modules[i]
329
- Jac.jac_import(
330
- self.mach, "deep_import_mods", base_path=self.fixture_abs_path("./")
331
- )
332
- mods = self.mach.loaded_modules.keys()
311
+ captured_output = io.StringIO()
312
+ sys.stdout = captured_output
313
+ Jac.jac_import("deep_import_mods", base_path=self.fixture_abs_path("./"))
314
+ sys.stdout = sys.__stdout__
315
+ stdout_value = eval(captured_output.getvalue())
333
316
  for i in targets:
334
- self.assertIn(i, mods)
335
- self.assertEqual(len([i for i in mods if i.startswith("deep")]), 6)
317
+ self.assertIn(i, stdout_value)
336
318
 
337
319
  def test_deep_outer_imports_one(self) -> None:
338
320
  """Parse micro jac file."""
339
321
  captured_output = io.StringIO()
340
322
  sys.stdout = captured_output
341
323
  Jac.jac_import(
342
- self.mach,
343
324
  "deep.deeper.deep_outer_import",
344
325
  base_path=self.fixture_abs_path("./"),
345
326
  )
@@ -363,7 +344,7 @@ class JacLanguageTests(TestCase):
363
344
  """Test has lambda_goodness."""
364
345
  captured_output = io.StringIO()
365
346
  sys.stdout = captured_output
366
- Jac.jac_import(self.mach, "has_goodness", base_path=self.fixture_abs_path("./"))
347
+ Jac.jac_import("has_goodness", base_path=self.fixture_abs_path("./"))
367
348
  sys.stdout = sys.__stdout__
368
349
  stdout_value = captured_output.getvalue()
369
350
  self.assertEqual(stdout_value.split("\n")[0], "mylist: [1, 2, 3]")
@@ -373,7 +354,7 @@ class JacLanguageTests(TestCase):
373
354
  """Test conn assign on edges."""
374
355
  captured_output = io.StringIO()
375
356
  sys.stdout = captured_output
376
- Jac.jac_import(self.mach, "edge_ops", base_path=self.fixture_abs_path("./"))
357
+ Jac.jac_import("edge_ops", base_path=self.fixture_abs_path("./"))
377
358
  sys.stdout = sys.__stdout__
378
359
  stdout_value = captured_output.getvalue()
379
360
  self.assertIn("[(3, 5), (14, 1), (5, 1)]", stdout_value)
@@ -384,7 +365,7 @@ class JacLanguageTests(TestCase):
384
365
  """Test conn assign on edges."""
385
366
  captured_output = io.StringIO()
386
367
  sys.stdout = captured_output
387
- Jac.jac_import(self.mach, "disconn", base_path=self.fixture_abs_path("./"))
368
+ Jac.jac_import("disconn", base_path=self.fixture_abs_path("./"))
388
369
  sys.stdout = sys.__stdout__
389
370
  stdout_value = captured_output.getvalue().split("\n")
390
371
  self.assertIn("c(cc=0)", stdout_value[0])
@@ -401,7 +382,7 @@ class JacLanguageTests(TestCase):
401
382
  """Test conn assign on edges."""
402
383
  captured_output = io.StringIO()
403
384
  sys.stdout = captured_output
404
- Jac.jac_import(self.mach, "simple_archs", base_path=self.fixture_abs_path("./"))
385
+ Jac.jac_import("simple_archs", base_path=self.fixture_abs_path("./"))
405
386
  sys.stdout = sys.__stdout__
406
387
  stdout_value = captured_output.getvalue()
407
388
  self.assertEqual(stdout_value.split("\n")[0], "1 2 0")
@@ -411,7 +392,7 @@ class JacLanguageTests(TestCase):
411
392
  """Test walking through edges."""
412
393
  captured_output = io.StringIO()
413
394
  sys.stdout = captured_output
414
- Jac.jac_import(self.mach, "edges_walk", base_path=self.fixture_abs_path("./"))
395
+ Jac.jac_import("edges_walk", base_path=self.fixture_abs_path("./"))
415
396
  sys.stdout = sys.__stdout__
416
397
  stdout_value = captured_output.getvalue()
417
398
  self.assertIn("creator()\n", stdout_value)
@@ -424,7 +405,7 @@ class JacLanguageTests(TestCase):
424
405
  """Test walking through edges."""
425
406
  captured_output = io.StringIO()
426
407
  sys.stdout = captured_output
427
- Jac.jac_import(self.mach, "tuplytuples", base_path=self.fixture_abs_path("./"))
408
+ Jac.jac_import("tuplytuples", base_path=self.fixture_abs_path("./"))
428
409
  sys.stdout = sys.__stdout__
429
410
  stdout_value = captured_output.getvalue()
430
411
  self.assertIn(
@@ -436,9 +417,7 @@ class JacLanguageTests(TestCase):
436
417
  """Test walking through edges."""
437
418
  captured_output = io.StringIO()
438
419
  sys.stdout = captured_output
439
- Jac.jac_import(
440
- self.mach, "deferred_field", base_path=self.fixture_abs_path("./")
441
- )
420
+ Jac.jac_import("deferred_field", base_path=self.fixture_abs_path("./"))
442
421
  sys.stdout = sys.__stdout__
443
422
  stdout_value = captured_output.getvalue()
444
423
  self.assertIn(
@@ -450,9 +429,7 @@ class JacLanguageTests(TestCase):
450
429
  """Test the dot gen of nodes and edges as a builtin."""
451
430
  captured_output = io.StringIO()
452
431
  sys.stdout = captured_output
453
- Jac.jac_import(
454
- self.mach, "builtin_printgraph", base_path=self.fixture_abs_path("./")
455
- )
432
+ Jac.jac_import("builtin_printgraph", base_path=self.fixture_abs_path("./"))
456
433
  sys.stdout = sys.__stdout__
457
434
  stdout_value = captured_output.getvalue()
458
435
  self.assertEqual(stdout_value.count("True"), 16)
@@ -461,7 +438,7 @@ class JacLanguageTests(TestCase):
461
438
  """Test walking through edges."""
462
439
  captured_output = io.StringIO()
463
440
  sys.stdout = captured_output
464
- Jac.jac_import(self.mach, "with_context", base_path=self.fixture_abs_path("./"))
441
+ Jac.jac_import("with_context", base_path=self.fixture_abs_path("./"))
465
442
  sys.stdout = sys.__stdout__
466
443
  stdout_value = captured_output.getvalue()
467
444
  self.assertIn("im in", stdout_value)
@@ -476,9 +453,7 @@ class JacLanguageTests(TestCase):
476
453
  """Parse micro jac file."""
477
454
  captured_output = io.StringIO()
478
455
  sys.stdout = captured_output
479
- Jac.jac_import(
480
- self.mach, "micro.typed_filter_compr", base_path=self.examples_abs_path("")
481
- )
456
+ Jac.jac_import("micro.typed_filter_compr", base_path=self.examples_abs_path(""))
482
457
  sys.stdout = sys.__stdout__
483
458
  stdout_value = captured_output.getvalue()
484
459
  self.assertIn(
@@ -492,9 +467,7 @@ class JacLanguageTests(TestCase):
492
467
  """Test walking through edges and nodes."""
493
468
  captured_output = io.StringIO()
494
469
  sys.stdout = captured_output
495
- Jac.jac_import(
496
- self.mach, "edge_node_walk", base_path=self.fixture_abs_path("./")
497
- )
470
+ Jac.jac_import("edge_node_walk", base_path=self.fixture_abs_path("./"))
498
471
  sys.stdout = sys.__stdout__
499
472
  stdout_value = captured_output.getvalue()
500
473
  self.assertIn("creator()\n", stdout_value)
@@ -513,9 +486,7 @@ class JacLanguageTests(TestCase):
513
486
  """Test Enum as member stmt."""
514
487
  captured_output = io.StringIO()
515
488
  sys.stdout = captured_output
516
- Jac.jac_import(
517
- self.mach, "enum_inside_archtype", base_path=self.fixture_abs_path("./")
518
- )
489
+ Jac.jac_import("enum_inside_archtype", base_path=self.fixture_abs_path("./"))
519
490
  sys.stdout = sys.__stdout__
520
491
  stdout_value = captured_output.getvalue()
521
492
  self.assertIn("2 Accessing privileged Data", stdout_value)
@@ -536,7 +507,6 @@ class JacLanguageTests(TestCase):
536
507
  ),
537
508
  prog=JacProgram(),
538
509
  ).ir_out.unparse()
539
- print(output)
540
510
  self.assertIn("def greet2(**kwargs: Any)", output)
541
511
  self.assertEqual(output.count("with entry {"), 14)
542
512
  self.assertIn("assert (x == 5) , 'x should be equal to 5' ;", output)
@@ -607,7 +577,7 @@ class JacLanguageTests(TestCase):
607
577
  ),
608
578
  prog=None,
609
579
  ).ir_out.unparse()
610
- self.assertIn("match Container(inner=Inner(x=a, y=b)) { \n", output)
580
+ self.assertIn("match Container(inner=Inner(x=a, y=b)) {\n", output)
611
581
  self.assertIn("case Container(inner = Inner(x = a, y = 0)):\n", output)
612
582
  self.assertIn("case Container(inner = Inner(x = a, y = b)):\n", output)
613
583
  self.assertIn("case _:\n", output)
@@ -616,7 +586,7 @@ class JacLanguageTests(TestCase):
616
586
  """Test py ast to Jac ast conversion output."""
617
587
  captured_output = io.StringIO()
618
588
  sys.stdout = captured_output
619
- Jac.jac_import(self.mach, "refs_target", base_path=self.fixture_abs_path("./"))
589
+ Jac.jac_import("refs_target", base_path=self.fixture_abs_path("./"))
620
590
  sys.stdout = sys.__stdout__
621
591
  stdout_value = captured_output.getvalue()
622
592
  self.assertIn("[c(val=0), c(val=1), c(val=2)]", stdout_value)
@@ -624,14 +594,14 @@ class JacLanguageTests(TestCase):
624
594
 
625
595
  def test_py_kw_as_name_disallowed(self) -> None:
626
596
  """Basic precedence test."""
627
- (prog := JacProgram()).compile_from_str(
628
- "with entry {print.is.not.True(4-5-4);}", "test.jac"
597
+ (prog := JacProgram()).compile(
598
+ use_str="with entry {print.is.not.True(4-5-4);}", file_path="test.jac"
629
599
  )
630
600
  self.assertIn("Python keyword is used as name", str(prog.errors_had[0].msg))
631
601
 
632
602
  def test_double_format_issue(self) -> None:
633
603
  """Basic precedence test."""
634
- prog = JacProgram().compile_from_str("with entry {print(hello);}", "test.jac")
604
+ prog = JacProgram().compile("with entry {print(hello);}", "test.jac")
635
605
  prog.unparse()
636
606
  before = prog.format()
637
607
  prog.format()
@@ -643,9 +613,7 @@ class JacLanguageTests(TestCase):
643
613
  """Test py ast to Jac ast conversion output."""
644
614
  captured_output = io.StringIO()
645
615
  sys.stdout = captured_output
646
- Jac.jac_import(
647
- self.mach, "inherit_check", base_path=self.fixture_abs_path("./")
648
- )
616
+ Jac.jac_import("inherit_check", base_path=self.fixture_abs_path("./"))
649
617
  sys.stdout = sys.__stdout__
650
618
  stdout_value = captured_output.getvalue()
651
619
  self.assertEqual("I am in b\nI am in b\nwww is also in b\n", stdout_value)
@@ -654,7 +622,7 @@ class JacLanguageTests(TestCase):
654
622
  """Test tuple unpack."""
655
623
  captured_output = io.StringIO()
656
624
  sys.stdout = captured_output
657
- Jac.jac_import(self.mach, "tupleunpack", base_path=self.fixture_abs_path("./"))
625
+ Jac.jac_import("tupleunpack", base_path=self.fixture_abs_path("./"))
658
626
  sys.stdout = sys.__stdout__
659
627
  stdout_value = captured_output.getvalue().split("\n")
660
628
  self.assertIn("1", stdout_value[0])
@@ -664,9 +632,7 @@ class JacLanguageTests(TestCase):
664
632
  """Test trailing comma."""
665
633
  captured_output = io.StringIO()
666
634
  sys.stdout = captured_output
667
- Jac.jac_import(
668
- self.mach, "trailing_comma", base_path=self.fixture_abs_path("./")
669
- )
635
+ Jac.jac_import("trailing_comma", base_path=self.fixture_abs_path("./"))
670
636
  sys.stdout = sys.__stdout__
671
637
  stdout_value = captured_output.getvalue()
672
638
  self.assertIn("Code compiled and ran successfully!", stdout_value)
@@ -675,7 +641,7 @@ class JacLanguageTests(TestCase):
675
641
  """Test try finally."""
676
642
  captured_output = io.StringIO()
677
643
  sys.stdout = captured_output
678
- Jac.jac_import(self.mach, "try_finally", base_path=self.fixture_abs_path("./"))
644
+ Jac.jac_import("try_finally", base_path=self.fixture_abs_path("./"))
679
645
  sys.stdout = sys.__stdout__
680
646
  stdout_value = captured_output.getvalue().split("\n")
681
647
  self.assertIn("try block", stdout_value[0])
@@ -688,9 +654,7 @@ class JacLanguageTests(TestCase):
688
654
  """Test arithmetic bug."""
689
655
  captured_output = io.StringIO()
690
656
  sys.stdout = captured_output
691
- Jac.jac_import(
692
- self.mach, "arithmetic_bug", base_path=self.fixture_abs_path("./")
693
- )
657
+ Jac.jac_import("arithmetic_bug", base_path=self.fixture_abs_path("./"))
694
658
  sys.stdout = sys.__stdout__
695
659
  stdout_value = captured_output.getvalue().split("\n")
696
660
  self.assertEqual("0.0625", stdout_value[0])
@@ -703,7 +667,7 @@ class JacLanguageTests(TestCase):
703
667
  """Test lambda expr."""
704
668
  captured_output = io.StringIO()
705
669
  sys.stdout = captured_output
706
- Jac.jac_import(self.mach, "lambda", base_path=self.fixture_abs_path("./"))
670
+ Jac.jac_import("lambda", base_path=self.fixture_abs_path("./"))
707
671
  sys.stdout = sys.__stdout__
708
672
  stdout_value = captured_output.getvalue().split("\n")
709
673
  self.assertEqual("9", stdout_value[0])
@@ -713,9 +677,7 @@ class JacLanguageTests(TestCase):
713
677
  """Test py ast to Jac ast conversion output."""
714
678
  captured_output = io.StringIO()
715
679
  sys.stdout = captured_output
716
- Jac.jac_import(
717
- self.mach, "walker_override", base_path=self.fixture_abs_path("./")
718
- )
680
+ Jac.jac_import("walker_override", base_path=self.fixture_abs_path("./"))
719
681
  sys.stdout = sys.__stdout__
720
682
  stdout_value = captured_output.getvalue()
721
683
  self.assertEqual("baz\nbar\n", stdout_value)
@@ -724,7 +686,7 @@ class JacLanguageTests(TestCase):
724
686
  """Test py ast to Jac ast conversion output."""
725
687
  captured_output = io.StringIO()
726
688
  sys.stdout = captured_output
727
- Jac.jac_import(self.mach, "nosigself", base_path=self.fixture_abs_path("./"))
689
+ Jac.jac_import("nosigself", base_path=self.fixture_abs_path("./"))
728
690
  sys.stdout = sys.__stdout__
729
691
  stdout_value = captured_output.getvalue()
730
692
  self.assertEqual(stdout_value.count("5"), 2)
@@ -733,9 +695,7 @@ class JacLanguageTests(TestCase):
733
695
  """Test py ast to Jac ast conversion output."""
734
696
  captured_output = io.StringIO()
735
697
  sys.stdout = captured_output
736
- Jac.jac_import(
737
- self.mach, "hash_init_check", base_path=self.fixture_abs_path("./")
738
- )
698
+ Jac.jac_import("hash_init_check", base_path=self.fixture_abs_path("./"))
739
699
  sys.stdout = sys.__stdout__
740
700
  stdout_value = captured_output.getvalue()
741
701
  self.assertIn("Test Passed", stdout_value)
@@ -765,9 +725,7 @@ class JacLanguageTests(TestCase):
765
725
  """Test importing python."""
766
726
  captured_output = io.StringIO()
767
727
  sys.stdout = captured_output
768
- Jac.jac_import(
769
- self.mach, "edgetypeissue", base_path=self.fixture_abs_path("./")
770
- )
728
+ Jac.jac_import("edgetypeissue", base_path=self.fixture_abs_path("./"))
771
729
  sys.stdout = sys.__stdout__
772
730
  stdout_value = captured_output.getvalue()
773
731
  self.assertIn("[x()]", stdout_value)
@@ -776,9 +734,7 @@ class JacLanguageTests(TestCase):
776
734
  """Test importing python."""
777
735
  captured_output = io.StringIO()
778
736
  sys.stdout = captured_output
779
- Jac.jac_import(
780
- self.mach, "blankwithentry", base_path=self.fixture_abs_path("./")
781
- )
737
+ Jac.jac_import("blankwithentry", base_path=self.fixture_abs_path("./"))
782
738
  sys.stdout = sys.__stdout__
783
739
  stdout_value = captured_output.getvalue()
784
740
  self.assertIn("i work", stdout_value)
@@ -787,7 +743,7 @@ class JacLanguageTests(TestCase):
787
743
  """Test importing python."""
788
744
  captured_output = io.StringIO()
789
745
  sys.stdout = captured_output
790
- Jac.jac_import(self.mach, "dblhello", base_path=self.fixture_abs_path("./"))
746
+ Jac.jac_import("dblhello", base_path=self.fixture_abs_path("./"))
791
747
  sys.stdout = sys.__stdout__
792
748
  stdout_value = captured_output.getvalue()
793
749
  self.assertEqual(stdout_value.count("Hello World!"), 1)
@@ -797,7 +753,7 @@ class JacLanguageTests(TestCase):
797
753
  """Test class method output."""
798
754
  captured_output = io.StringIO()
799
755
  sys.stdout = captured_output
800
- Jac.jac_import(self.mach, "cls_method", base_path=self.fixture_abs_path("./"))
756
+ Jac.jac_import("cls_method", base_path=self.fixture_abs_path("./"))
801
757
  sys.stdout = sys.__stdout__
802
758
  stdout_value = captured_output.getvalue().split("\n")
803
759
  self.assertEqual("MyClass", stdout_value[0])
@@ -806,10 +762,14 @@ class JacLanguageTests(TestCase):
806
762
 
807
763
  def test_list_methods(self) -> None:
808
764
  """Test list_modules, list_walkers, list_nodes, and list_edges."""
765
+ Jac.reset_machine()
766
+ Jac.set_base_path(self.fixture_abs_path("."))
767
+ sys.modules.pop("foo", None)
768
+ sys.modules.pop("bar", None)
809
769
  captured_output = io.StringIO()
810
770
  sys.stdout = captured_output
811
771
 
812
- Jac.jac_import(self.mach, "foo", base_path=self.fixture_abs_path("."))
772
+ Jac.jac_import("foo", base_path=self.fixture_abs_path("."))
813
773
 
814
774
  sys.stdout = sys.__stdout__
815
775
  stdout_value = captured_output.getvalue()
@@ -833,6 +793,9 @@ class JacLanguageTests(TestCase):
833
793
 
834
794
  def test_walker_dynamic_update(self) -> None:
835
795
  """Test dynamic update of a walker during runtime."""
796
+ Jac.reset_machine()
797
+ Jac.set_base_path(self.fixture_abs_path("."))
798
+ sys.modules.pop("bar", None)
836
799
  session = self.fixture_abs_path("bar_walk.session")
837
800
  bar_file_path = self.fixture_abs_path("bar.jac")
838
801
  update_file_path = self.fixture_abs_path("walker_update.jac")
@@ -846,6 +809,7 @@ class JacLanguageTests(TestCase):
846
809
  )
847
810
  sys.stdout = sys.__stdout__
848
811
  stdout_value = captured_output.getvalue()
812
+ os.remove(session) if os.path.exists(session) else None
849
813
  expected_output = "Created 5 items."
850
814
  self.assertIn(expected_output, stdout_value.split("\n"))
851
815
  # Define the new behavior to be added
@@ -975,9 +939,7 @@ class JacLanguageTests(TestCase):
975
939
  """Test match case with multiple expressions."""
976
940
  captured_output = io.StringIO()
977
941
  sys.stdout = captured_output
978
- Jac.jac_import(
979
- self.mach, "match_multi_ex", base_path=self.fixture_abs_path("./")
980
- )
942
+ Jac.jac_import("match_multi_ex", base_path=self.fixture_abs_path("./"))
981
943
  sys.stdout = sys.__stdout__
982
944
  stdout_value = captured_output.getvalue().split("\n")
983
945
  self.assertEqual("Ten", stdout_value[0])
@@ -987,7 +949,7 @@ class JacLanguageTests(TestCase):
987
949
  """Test entry and exit behavior of walker."""
988
950
  captured_output = io.StringIO()
989
951
  sys.stdout = captured_output
990
- Jac.jac_import(self.mach, "entry_exit", base_path=self.fixture_abs_path("./"))
952
+ Jac.jac_import("entry_exit", base_path=self.fixture_abs_path("./"))
991
953
  sys.stdout = sys.__stdout__
992
954
  stdout_value = captured_output.getvalue().split("\n")
993
955
  self.assertIn("Entering at the beginning of walker: Root()", stdout_value[0])
@@ -1000,7 +962,7 @@ class JacLanguageTests(TestCase):
1000
962
  """Test entry and exit behavior of walker."""
1001
963
  captured_output = io.StringIO()
1002
964
  sys.stdout = captured_output
1003
- Jac.jac_import(self.mach, "visit_order", base_path=self.fixture_abs_path("./"))
965
+ Jac.jac_import("visit_order", base_path=self.fixture_abs_path("./"))
1004
966
  sys.stdout = sys.__stdout__
1005
967
  stdout_value = captured_output.getvalue()
1006
968
  self.assertEqual("[MyNode(Name='End'), MyNode(Name='Middle')]\n", stdout_value)
@@ -1009,9 +971,7 @@ class JacLanguageTests(TestCase):
1009
971
  """Test supporting multiple global variable in a statement."""
1010
972
  captured_output = io.StringIO()
1011
973
  sys.stdout = captured_output
1012
- Jac.jac_import(
1013
- self.mach, "glob_multivar_statement", base_path=self.fixture_abs_path("./")
1014
- )
974
+ Jac.jac_import("glob_multivar_statement", base_path=self.fixture_abs_path("./"))
1015
975
  sys.stdout = sys.__stdout__
1016
976
  stdout_value = captured_output.getvalue().split("\n")
1017
977
  self.assertIn("Hello World !", stdout_value[0])
@@ -1021,9 +981,7 @@ class JacLanguageTests(TestCase):
1021
981
  """Test archetype definition bug."""
1022
982
  captured_output = io.StringIO()
1023
983
  sys.stdout = captured_output
1024
- Jac.jac_import(
1025
- self.mach, "archetype_def_bug", base_path=self.fixture_abs_path("./")
1026
- )
984
+ Jac.jac_import("archetype_def_bug", base_path=self.fixture_abs_path("./"))
1027
985
  sys.stdout = sys.__stdout__
1028
986
  stdout_value = captured_output.getvalue().split("\n")
1029
987
  self.assertIn("MyWalker", stdout_value[0])
@@ -1033,9 +991,7 @@ class JacLanguageTests(TestCase):
1033
991
  """Test conn assign on edges."""
1034
992
  captured_output = io.StringIO()
1035
993
  sys.stdout = captured_output
1036
- Jac.jac_import(
1037
- self.mach, "visit_sequence", base_path=self.fixture_abs_path("./")
1038
- )
994
+ Jac.jac_import("visit_sequence", base_path=self.fixture_abs_path("./"))
1039
995
  sys.stdout = sys.__stdout__
1040
996
  self.assertEqual(
1041
997
  "walker entry\nwalker enter to root\n"
@@ -1050,9 +1006,7 @@ class JacLanguageTests(TestCase):
1050
1006
  """Test connect traverse syntax."""
1051
1007
  captured_output = io.StringIO()
1052
1008
  sys.stdout = captured_output
1053
- Jac.jac_import(
1054
- self.mach, "connect_traverse_syntax", base_path=self.fixture_abs_path("./")
1055
- )
1009
+ Jac.jac_import("connect_traverse_syntax", base_path=self.fixture_abs_path("./"))
1056
1010
  sys.stdout = sys.__stdout__
1057
1011
  stdout_value = captured_output.getvalue().split("\n")
1058
1012
  self.assertIn("A(val=5), A(val=10)", stdout_value[0])
@@ -1068,7 +1022,7 @@ class JacLanguageTests(TestCase):
1068
1022
  """Test complex nested impls."""
1069
1023
  captured_output = io.StringIO()
1070
1024
  sys.stdout = captured_output
1071
- Jac.jac_import(self.mach, "node_del", base_path=self.fixture_abs_path("./"))
1025
+ Jac.jac_import("node_del", base_path=self.fixture_abs_path("./"))
1072
1026
  sys.stdout = sys.__stdout__
1073
1027
  stdout_value = captured_output.getvalue().split("\n")
1074
1028
  self.assertIn("0 : [2, 3, 4, 5, 6, 7, 8, 9, 10]", stdout_value[0])
@@ -1108,7 +1062,7 @@ class JacLanguageTests(TestCase):
1108
1062
  sys.stdout = captured_output
1109
1063
  original_cwd = os.getcwd()
1110
1064
  try:
1111
- Jac.jac_import(self.mach, "importer_site", base_path=tmpdir)
1065
+ Jac.jac_import("importer_site", base_path=tmpdir)
1112
1066
  finally:
1113
1067
  os.chdir(original_cwd)
1114
1068
  sys.stdout = sys.__stdout__
@@ -1197,19 +1151,18 @@ class JacLanguageTests(TestCase):
1197
1151
  """Test async walker."""
1198
1152
  captured_output = io.StringIO()
1199
1153
  sys.stdout = captured_output
1200
- Jac.jac_import(self.mach, "async_walker", base_path=self.fixture_abs_path("./"))
1154
+ Jac.jac_import("async_walker", base_path=self.fixture_abs_path("./"))
1201
1155
  sys.stdout = sys.__stdout__
1202
1156
  stdout_value = captured_output.getvalue().split("\n")
1203
- self.assertNotIn("It is non blocking", stdout_value[4])
1204
- self.assertIn("W(num=8)", stdout_value[5])
1157
+ self.assertIn("Let's start the task", stdout_value[0])
1158
+ self.assertIn("It is Coroutine task True", stdout_value[1])
1159
+ self.assertIn("Coroutine task is completed", stdout_value[6])
1205
1160
 
1206
- def test_async_ability(self) -> None:
1161
+ def test_async_function(self) -> None:
1207
1162
  """Test async ability."""
1208
1163
  captured_output = io.StringIO()
1209
1164
  sys.stdout = captured_output
1210
- Jac.jac_import(
1211
- self.mach, "async_ability", base_path=self.fixture_abs_path("./")
1212
- )
1165
+ Jac.jac_import("async_function", base_path=self.fixture_abs_path("./"))
1213
1166
  sys.stdout = sys.__stdout__
1214
1167
  stdout_value = captured_output.getvalue().split("\n")
1215
1168
  self.assertIn("Hello", stdout_value[0])
@@ -1220,7 +1173,7 @@ class JacLanguageTests(TestCase):
1220
1173
  """Test concurrency in jaclang."""
1221
1174
  captured_output = io.StringIO()
1222
1175
  sys.stdout = captured_output
1223
- Jac.jac_import(self.mach, "concurrency", base_path=self.fixture_abs_path("./"))
1176
+ Jac.jac_import("concurrency", base_path=self.fixture_abs_path("./"))
1224
1177
  sys.stdout = sys.__stdout__
1225
1178
  stdout_value = captured_output.getvalue().split("\n")
1226
1179
  self.assertIn("Started", stdout_value[0])
@@ -1286,9 +1239,7 @@ class JacLanguageTests(TestCase):
1286
1239
  """Test visitor, here keyword usage in jaclang."""
1287
1240
  captured_output = io.StringIO()
1288
1241
  sys.stdout = captured_output
1289
- Jac.jac_import(
1290
- self.mach, "here_visitor_usage", base_path=self.fixture_abs_path("./")
1291
- )
1242
+ Jac.jac_import("here_visitor_usage", base_path=self.fixture_abs_path("./"))
1292
1243
  sys.stdout = sys.__stdout__
1293
1244
  stdout_value = captured_output.getvalue().split("\n")
1294
1245
  self.assertIn("Here value is 10", stdout_value[0])
@@ -1342,3 +1293,50 @@ class JacLanguageTests(TestCase):
1342
1293
  self.assertIn("MyWalker() from node MyNode(val=40)", stdout_value[6])
1343
1294
  self.assertIn("MyWalker() from node MyNode(val=90)", stdout_value[7])
1344
1295
  self.assertIn("MyWalker() from node MyNode(val=70)", stdout_value[9])
1296
+
1297
+ def test_async_ability(self) -> None:
1298
+ """Test async ability."""
1299
+ captured_output = io.StringIO()
1300
+ sys.stdout = captured_output
1301
+ Jac.jac_import("async_ability", base_path=self.fixture_abs_path("./"))
1302
+ sys.stdout = sys.__stdout__
1303
+ stdout_value = captured_output.getvalue().split("\n")
1304
+ self.assertIn("Let's start the task", stdout_value[0])
1305
+ self.assertIn("It is Coroutine task True", stdout_value[1])
1306
+ self.assertIn("I am here man MyNode(val=5)", stdout_value[2])
1307
+ self.assertIn("Async function", stdout_value[3])
1308
+ self.assertIn("foo3", stdout_value[4])
1309
+ self.assertIn("foo1", stdout_value[5])
1310
+ self.assertIn("foo2", stdout_value[6])
1311
+ self.assertIn("Coroutine task is completed", stdout_value[17])
1312
+
1313
+ def test_unicode_string_literals(self) -> None:
1314
+ """Test unicode characters in string literals are preserved correctly."""
1315
+ captured_output = io.StringIO()
1316
+ sys.stdout = captured_output
1317
+ Jac.jac_import("unicode_strings", base_path=self.fixture_abs_path("./"))
1318
+ sys.stdout = sys.__stdout__
1319
+ stdout_value = captured_output.getvalue().split("\n")
1320
+ self.assertIn("1. ✓ 1st (due: True)", stdout_value[0])
1321
+ self.assertIn("🌟 Star", stdout_value[2])
1322
+ self.assertIn("Multi-line with ✓ unicode and ○ symbols", stdout_value[3])
1323
+ self.assertIn("Raw string with ✓ and ○", stdout_value[4])
1324
+ self.assertIn("Tab ✓", stdout_value[5])
1325
+ self.assertIn("Newline ○", stdout_value[6])
1326
+
1327
+ def test_sitecustomize_meta_importer(self) -> None:
1328
+ """Verify Jac modules importable without importing jaclang."""
1329
+ with tempfile.TemporaryDirectory() as tmpdir:
1330
+ Path(tmpdir, "mymod.jac").write_text('with entry {print("via meta");}')
1331
+ env = os.environ.copy()
1332
+ project_root = Path(__file__).resolve().parents[2]
1333
+ env["PYTHONPATH"] = os.pathsep.join([str(project_root), tmpdir])
1334
+ proc = subprocess.run(
1335
+ [sys.executable, "-c", "import mymod"],
1336
+ capture_output=True,
1337
+ text=True,
1338
+ cwd=tmpdir,
1339
+ env=env,
1340
+ )
1341
+ self.assertEqual(proc.returncode, 0, proc.stderr)
1342
+ self.assertEqual(proc.stdout.strip(), "via meta")