MCPcopy Index your code
hub / github.com/python/cpython / test_complex_tree

Method test_complex_tree

Lib/test/test_asyncio/test_tools.py:1317–1363  ·  view source on GitHub ↗

Test build_async_tree with a more complex tree structure.

(self)

Source from the content-addressed store, hash-verified

1315 self.assertEqual(context.exception.cycles, [[3, 2, 3]])
1316
1317 def test_complex_tree(self):
1318 """Test build_async_tree with a more complex tree structure."""
1319 result = [
1320 AwaitedInfo(
1321 thread_id=1,
1322 awaited_by=[
1323 TaskInfo(
1324 task_id=2,
1325 task_name="Task-1",
1326 coroutine_stack=[],
1327 awaited_by=[]
1328 ),
1329 TaskInfo(
1330 task_id=3,
1331 task_name="Task-2",
1332 coroutine_stack=[],
1333 awaited_by=[
1334 CoroInfo(
1335 call_stack=[FrameInfo("main", "", LocationInfo(0))],
1336 task_name=2
1337 )
1338 ]
1339 ),
1340 TaskInfo(
1341 task_id=4,
1342 task_name="Task-3",
1343 coroutine_stack=[],
1344 awaited_by=[
1345 CoroInfo(
1346 call_stack=[FrameInfo("main", "", LocationInfo(0))],
1347 task_name=3
1348 )
1349 ]
1350 )
1351 ]
1352 )
1353 ]
1354 expected_output = [
1355 [
1356 "└── (T) Task-1",
1357 " └── main",
1358 " └── (T) Task-2",
1359 " └── main",
1360 " └── (T) Task-3",
1361 ]
1362 ]
1363 self.assertEqual(tools.build_async_tree(result), expected_output)
1364
1365 def test_complex_table(self):
1366 """Test build_task_table with a more complex tree structure."""

Callers

nothing calls this directly

Calls 2

FrameInfoClass · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected