Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit 336d916

Browse files
committed
Fix changes
1 parent 32651b6 commit 336d916

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

python/selfie-lib/selfie_lib/WriteTracker.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from typing import List, Optional
22
from selfie_lib.CommentTracker import SnapshotFileLayout
33
import inspect
4+
from functools import total_ordering
45

56

7+
@total_ordering
68
class CallLocation:
79
def __init__(self, file_name: Optional[str], line: int):
810
self._file_name = file_name

python/selfie-lib/tests/RecordCall_test.py

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from unittest.mock import Mock
22
from selfie_lib.WriteTracker import CallLocation, CallStack, recordCall
3+
import os
34

45

56
def test_call_location_ide_link():
@@ -22,10 +23,25 @@ def test_call_stack_ide_link():
2223

2324
def test_record_call_with_caller_file_only_false():
2425
call_stack = recordCall(False)
26+
2527
assert (
2628
len(call_stack.rest_of_stack) > 0
2729
), "Expected the rest of stack to contain more than one CallLocation"
2830

31+
expected_call_location_str = "File: RecordCall_test.py, Line: 25"
32+
33+
if call_stack.location.file_name is not None:
34+
actual_file_name = os.path.basename(call_stack.location.file_name)
35+
actual_call_location_str = (
36+
f"File: {actual_file_name}, Line: {call_stack.location.line}"
37+
)
38+
else:
39+
actual_call_location_str = "File name is None"
40+
41+
assert (
42+
actual_call_location_str == expected_call_location_str
43+
), f"Expected call location to be '{expected_call_location_str}' but was '{actual_call_location_str}'"
44+
2945

3046
def test_record_call_with_caller_file_only_true():
3147
call_stack = recordCall(True)

0 commit comments

Comments
 (0)