Skip to content

Commit e9fbf9c

Browse files
committed
remove more absolute paths from test output
1 parent b9a55e9 commit e9fbf9c

10 files changed

Lines changed: 13 additions & 26 deletions

File tree

python/TODO_nowrappers.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
* Python 3.13 and 3.14?
2-
* Installation
31
* Test windows
4-
* README
52
* location matcher for vscode
6-
7-
* Debug slow startup times
83
* show "@record\nclass C" for record attributes
94

python/code/wypp/stacktrace.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def isRunpyFrame(frame: types.FrameType) -> bool:
4343
def limitTraceback(frameList: list[types.FrameType],
4444
extraFrames: list[inspect.FrameInfo],
4545
filter: bool) -> traceback.StackSummary:
46-
origFrameList = frameList
4746
if filter:
4847
# Step 1: remove all frames that appear after the first _call_with_frames_removed
4948
endIdx = len(frameList)

python/code/wypp/writeYourProgram.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import stacktrace
88
import renderTy
99
import location
10+
import paths
11+
import utils
1012

1113
_DEBUG = False
1214
def _debug(s):
@@ -89,9 +91,7 @@ def formatArg(x):
8991
loc = None if caller is None else location.Loc.fromFrameInfo(caller)
9092
argStr = ', '.join([formatArg(x) for x in args])
9193
tyStr = f'{name}({argStr})'
92-
raise errors.WyppTypeError.invalidType(tyStr, loc)
93-
#argStr = ', '.join([formatArg(untypy.util.typehints.qualname(x)) for x in args])
94-
#raise untypy.error.WyppTypeError(f"Cannot call {name} like a function. Did you mean {name}[{argStr}]?")
94+
raise utils._call_with_frames_removed(errors.WyppTypeError.invalidType, tyStr, loc)
9595

9696
# This patch is needed to provide better error messages if a student passes type arguments
9797
# with paranthesis instead of square brackets
@@ -196,7 +196,8 @@ def checkGeneric(actual, expected, *, structuralObjEq=True, floatEqWithDelta=Tru
196196
stack = inspect.stack()
197197
frame = stack[2] if len(stack) > 2 else None
198198
if frame:
199-
caller = f"{frame.filename}:{frame.lineno}: "
199+
filename = paths.canonicalizePath(frame.filename)
200+
caller = f"Datei {filename}, Zeile {frame.lineno}: "
200201
else:
201202
caller = ""
202203
def fmt(x):
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FEHLER in /Users/swehr/devel/write-your-python-program/python/file-test-data/extras/testCheck_ok.py:13: Erwartet wird 2, aber das Ergebnis ist 1
2-
FEHLER in /Users/swehr/devel/write-your-python-program/python/file-test-data/extras/testCheck_ok.py:14: Erwartet wird 'xyz', aber das Ergebnis ist 'abc'
3-
FEHLER in /Users/swehr/devel/write-your-python-program/python/file-test-data/extras/testCheck_ok.py:15: Erwartet wird Point(x=1, y=3), aber das Ergebnis ist Point(x=1, y=2)
4-
FEHLER in /Users/swehr/devel/write-your-python-program/python/file-test-data/extras/testCheck_ok.py:16: Erwartet wird Point(x=1, y=3), aber das Ergebnis ist Name(firstName='Max', lastName='Müller')
1+
FEHLER in Datei file-test-data/extras/testCheck_ok.py, Zeile 13: Erwartet wird 2, aber das Ergebnis ist 1
2+
FEHLER in Datei file-test-data/extras/testCheck_ok.py, Zeile 14: Erwartet wird 'xyz', aber das Ergebnis ist 'abc'
3+
FEHLER in Datei file-test-data/extras/testCheck_ok.py, Zeile 15: Erwartet wird Point(x=1, y=3), aber das Ergebnis ist Point(x=1, y=2)
4+
FEHLER in Datei file-test-data/extras/testCheck_ok.py, Zeile 16: Erwartet wird Point(x=1, y=3), aber das Ergebnis ist Name(firstName='Max', lastName='Müller')
55
4 Tests, 4 Fehler 🙁
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
FEHLER in /Users/swehr/devel/write-your-python-program/python/file-test-data/extras/testDeepEqBug_ok.py:61: Erwartet wird SemesterM(degreeProgram='AKI', semester='1. Semester 2021/22', courses=[CourseM(name='Programmierung 1', teacher='Wehr', students=[]), CourseM(name='Grundlagen der Informatik', teacher='Oelke', students=[])]), aber das Ergebnis ist SemesterM(degreeProgram='AKI', semester='1. Semester 2021/22', courses=[CourseM(name='Programmierung 1', teacher='Wehr', students=['1234', '9876']), CourseM(name='Grundlagen der Informatik', teacher='Oelke', students=['1234'])])
1+
FEHLER in Datei file-test-data/extras/testDeepEqBug_ok.py, Zeile 61: Erwartet wird SemesterM(degreeProgram='AKI', semester='1. Semester 2021/22', courses=[CourseM(name='Programmierung 1', teacher='Wehr', students=[]), CourseM(name='Grundlagen der Informatik', teacher='Oelke', students=[])]), aber das Ergebnis ist SemesterM(degreeProgram='AKI', semester='1. Semester 2021/22', courses=[CourseM(name='Programmierung 1', teacher='Wehr', students=['1234', '9876']), CourseM(name='Grundlagen der Informatik', teacher='Oelke', students=['1234'])])
22
1 Test, 1 Fehler 🙁
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
FEHLER in /Users/swehr/devel/write-your-python-program/python/file-test-data/extras/testFunEq_ok.py:9: Erwartet wird <function bar at 0x00>, aber das Ergebnis ist <function foo at 0x00>
1+
FEHLER in Datei file-test-data/extras/testFunEq_ok.py, Zeile 9: Erwartet wird <function bar at 0x00>, aber das Ergebnis ist <function foo at 0x00>
22
1 Test, 1 Fehler 🙁

python/file-test-data/extras/testGetSource.err

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
Traceback (most recent call last):
22
File "file-test-data/extras/testGetSource.py", line 11, in <module>
33
Art = Literal('klein','mittag') # <= problem is here
4-
File "code/wypp/writeYourProgram.py", line 92, in _invalidCall
5-
raise errors.WyppTypeError.invalidType(tyStr, loc)
6-
File "code/wypp/errors.py", line 79, in invalidType
7-
raise WyppTypeError('\n'.join(lines))
84

95
WyppTypeError: ungültiger Typ `Literal('klein', 'mittag')`
106

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Traceback (most recent call last):
22
File "file-test-data/extras/testImpossible.py", line 3, in <module>
33
impossible()
4-
File "code/wypp/writeYourProgram.py", line 331, in impossible
4+
File "code/wypp/writeYourProgram.py", line 332, in impossible
55
raise errors.ImpossibleError(msg)
66

77
Das Unmögliche ist passiert!

python/file-test-data/extras/testLiteral1.err

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
Traceback (most recent call last):
22
File "file-test-data/extras/testLiteral1.py", line 3, in <module>
33
T = Literal('a', 'b')
4-
File "code/wypp/writeYourProgram.py", line 92, in _invalidCall
5-
raise errors.WyppTypeError.invalidType(tyStr, loc)
6-
File "code/wypp/errors.py", line 79, in invalidType
7-
raise WyppTypeError('\n'.join(lines))
84

95
WyppTypeError: ungültiger Typ `Literal('a', 'b')`
106

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Traceback (most recent call last):
22
File "file-test-data/extras/testTodo.py", line 3, in <module>
33
todo()
4-
File "code/wypp/writeYourProgram.py", line 326, in todo
4+
File "code/wypp/writeYourProgram.py", line 327, in todo
55
raise errors.TodoError(msg)
66

77
TODO

0 commit comments

Comments
 (0)