Skip to content

Commit

Permalink
Updated mock for unittest
Browse files Browse the repository at this point in the history
LucasAndradeDias committed Mar 13, 2024
1 parent 3334ac0 commit 879746d
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/data/new/module_1.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ def __init__(self, shape_type, dimensions):
self.shape_type = shape_type
self.dimensions = dimensions

def calculate_area(self):
def calculate_area1(self):
area = calculate_area(self.shape_type, self.dimensions)


@@ -19,7 +19,7 @@ def main():
]

for shape in shapes:
shape.calculate_area()
shape.calculate_area1()

processor = DataProcessor()
data = processor.load_data("sample_data.txt")
13 changes: 10 additions & 3 deletions tests/test_display.py
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@
import collections
import sys

from pathlib import Path
from pathlib import Path
from src.outliner import Display
from unittest.mock import patch
from io import StringIO


PATH = Path(str(Path(__file__).resolve() / "data" ) + "/module_testing_1.py")
PATH = Path(str(Path(__file__).resolve() / "data") + "/module_testing_1.py")

functions_flow = collections.OrderedDict(
[("test2", None), ("__init__", None), ("func1", None), ("func2", None)]
@@ -30,7 +30,14 @@
"test2": {"call": 1, "return": 1, "line": 2, "file": PATH, "start_line": 13},
"__init__": {"call": 1, "return": 1, "line": 1, "file": PATH, "start_line": 2},
"func1": {"call": 1, "return": 1, "line": 2, "file": PATH, "start_line": 5},
"func2": {"call": 1, "return": 1, "line": 1, "exception": 1, "file": PATH, "start_line": 9},
"func2": {
"call": 1,
"return": 1,
"line": 1,
"exception": 1,
"file": PATH,
"start_line": 9,
},
},
)

3 changes: 2 additions & 1 deletion tests/test_trace.py
Original file line number Diff line number Diff line change
@@ -79,6 +79,7 @@ def test_trace_run_with_imported_files(self):
r"Trace object\nrunned objects:"
r"\n main + \n __init__ + "
r"\n calculate_area1 + \n calculate_area + \n "
r"load_data + \n analyze_data + \n ")
r"load_data + \n analyze_data + \n "
)

self.assertEqual(expected_trace, repr(self.parser))

0 comments on commit 879746d

Please sign in to comment.