Skip to content

Commit

Permalink
switch to raw string for test
Browse files Browse the repository at this point in the history
  • Loading branch information
Esther-Goldberg committed Apr 9, 2024
1 parent fe2d933 commit 9739a0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion snekbox/nsjail.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ def _parse_attachments(
raise EvalError("TimeoutError: Exceeded time limit while parsing attachments") from e
except IllegalPathError as e:
log.info(f"Invalid bytes in filename while parsing attachments: {e}")
raise EvalError("FileParsingError: invalid bytes in filename while parsing attachments")
raise EvalError(
"FileParsingError: invalid bytes in filename while parsing attachments"
) from e
except Exception as e:
log.exception(f"Unexpected {type(e).__name__} while parse attachments", exc_info=e)
raise EvalError("FileParsingError: Unknown error while parsing attachments") from e
Expand Down
4 changes: 2 additions & 2 deletions tests/test_nsjail.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ def test_file_parsing_timeout(self):

def test_filename_encoding_illegal_chars(self):
code = dedent(
"""
r"""
with open(b"\xC3.txt", "w") as f:
f.write("test")
"""
).strip()
result = self.eval_code(code)
result = self.eval_file(code)
self.assertEqual(result.returncode, None)
self.assertEqual(
result.stdout, "FileParsingError: invalid bytes in filename while parsing attachments"
Expand Down

0 comments on commit 9739a0a

Please sign in to comment.