Skip to content

Commit

Permalink
more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sliu008 committed Dec 6, 2024
1 parent 2f4b1dd commit 10c3dfb
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/test_concise_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,27 @@ def test_module_identifier():
except RuntimeError as original_error:
concise_exception = ConciseException(original_error)

assert concise_exception.category == 'podaac/concise'
assert concise_exception.category == 'podaac/concise'

def test_exception_with_no_traceback():
"""
Test handling of an exception without an existing traceback.
"""
# Create an exception without a traceback
try:
raise ValueError("Test exception without traceback")
except ValueError as original_error:
# Deliberately remove the traceback
original_error.__traceback__ = None

# Create ConciseException
concise_exception = ConciseException(original_error)

# Verify that a traceback was generated
assert concise_exception.original_exception is not None

# Check that the message is still formatted
error_msg = concise_exception.message
assert "Error in file" in error_msg
assert "in function" in error_msg
assert "Test exception without traceback" in error_msg

0 comments on commit 10c3dfb

Please sign in to comment.