| 1 | # file scalene/scalene_mapfile.py:78-81 |
| 2 | # lines [78, 80, 81] |
| 3 | # branches [] |
| 4 | |
| 5 | import pytest |
| 6 | from scalene.scalene_mapfile import ScaleneMapFile |
| 7 | |
| 8 | |
| 9 | class MockScaleneMapFile(ScaleneMapFile): |
| 10 | def __init__(self, buf): |
| 11 | self._buf = buf |
| 12 | |
| 13 | |
| 14 | @pytest.fixture |
| 15 | def mock_map_file(): |
| 16 | buf = b"test_string\nmore_data" |
| 17 | return MockScaleneMapFile(buf) |
| 18 | |
| 19 | |
| 20 | def test_get_str(mock_map_file): |
| 21 | result = mock_map_file.get_str() |
| 22 | assert ( |
| 23 | result == "test_string" |
| 24 | ), f"The get_str method returned '{result}' instead of the expected string 'test_string'." |