This repository was archived by the owner on Apr 4, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 11from typing import List , Optional
22from selfie_lib .CommentTracker import SnapshotFileLayout
33import inspect
4+ from functools import total_ordering
45
56
7+ @total_ordering
68class CallLocation :
79 def __init__ (self , file_name : Optional [str ], line : int ):
810 self ._file_name = file_name
Original file line number Diff line number Diff line change 11from unittest .mock import Mock
22from selfie_lib .WriteTracker import CallLocation , CallStack , recordCall
3+ import os
34
45
56def test_call_location_ide_link ():
@@ -22,10 +23,25 @@ def test_call_stack_ide_link():
2223
2324def 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
3046def test_record_call_with_caller_file_only_true ():
3147 call_stack = recordCall (True )
You can’t perform that action at this time.
0 commit comments