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

Commit

Permalink
Fix changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hssahota2 committed Mar 11, 2024
1 parent 32651b6 commit 336d916
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/selfie-lib/selfie_lib/WriteTracker.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from typing import List, Optional
from selfie_lib.CommentTracker import SnapshotFileLayout
import inspect
from functools import total_ordering


@total_ordering
class CallLocation:
def __init__(self, file_name: Optional[str], line: int):
self._file_name = file_name
Expand Down
16 changes: 16 additions & 0 deletions python/selfie-lib/tests/RecordCall_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from unittest.mock import Mock
from selfie_lib.WriteTracker import CallLocation, CallStack, recordCall
import os


def test_call_location_ide_link():
Expand All @@ -22,10 +23,25 @@ def test_call_stack_ide_link():

def test_record_call_with_caller_file_only_false():
call_stack = recordCall(False)

assert (
len(call_stack.rest_of_stack) > 0
), "Expected the rest of stack to contain more than one CallLocation"

expected_call_location_str = "File: RecordCall_test.py, Line: 25"

if call_stack.location.file_name is not None:
actual_file_name = os.path.basename(call_stack.location.file_name)
actual_call_location_str = (
f"File: {actual_file_name}, Line: {call_stack.location.line}"
)
else:
actual_call_location_str = "File name is None"

assert (
actual_call_location_str == expected_call_location_str
), f"Expected call location to be '{expected_call_location_str}' but was '{actual_call_location_str}'"


def test_record_call_with_caller_file_only_true():
call_stack = recordCall(True)
Expand Down

0 comments on commit 336d916

Please sign in to comment.