| 1 | # file scalene/scalene_analysis.py:101-134 |
| 2 | # lines [133] |
| 3 | # branches ['130->133'] |
| 4 | |
| 5 | import pytest |
| 6 | from scalene.scalene_analysis import ScaleneAnalysis |
| 7 | |
| 8 | |
| 9 | def test_find_regions_with_no_classes_functions_or_loops(): |
| 10 | source_code = """ |
| 11 | # This is a simple script with no classes, functions, or loops. |
| 12 | x = 1 |
| 13 | y = 2 |
| 14 | z = x + y |
| 15 | print(z) |
| 16 | """.strip() |
| 17 | expected_regions = {1: (1, 1), 2: (2, 2), 3: (3, 3), 4: (4, 4), 5: (5, 5)} |
| 18 | regions = ScaleneAnalysis.find_regions(source_code) |
| 19 | assert regions == expected_regions |