moo.core.tests.test_exceptions

Tests for exception classes in moo/core/exceptions.py.

Section 1: Pure unit tests verifying that each exception type produces a

meaningful string message (no DB required).

Section 2: Integration tests confirming that naturally-triggered exceptions

propagate through parse.interpret and are caught/formatted by tasks.parse_command.

Section 3: Integration tests for exceptions raised directly by core framework

code: RecursiveError (Object.save), AmbiguousVerbError (Object.get_verb), and AccessError (Object.is_allowed).

Functions

test_access_error_raised_by_is_allowed(...)

AccessError is raised by is_allowed(fatal=True) when a deny rule fires.

test_access_error_str()

AccessError.__str__ identifies the accessor, action, and subject.

test_ambiguous_object_error_caught_by_parse_command(...)

tasks.parse_command catches AmbiguousObjectError and formats it as bold red.

test_ambiguous_object_error_raised_by_parser(...)

Parser raises AmbiguousObjectError when two objects share a name in scope.

test_ambiguous_object_error_str()

AmbiguousObjectError.__str__ includes the name and both candidates.

test_ambiguous_verb_error_raised_by_get_verb(...)

AmbiguousVerbError is raised by Object.get_verb() when an object has multiple Verb rows with the same name defined directly on it.

test_ambiguous_verb_error_str()

AmbiguousVerbError.__str__ includes the verb name and both candidates.

test_no_such_object_error_caught_by_parse_command(...)

tasks.parse_command catches NoSuchObjectError and formats it as bold red.

test_no_such_object_error_is_user_error()

NoSuchObjectError is a UserError subclass and str() contains the name.

test_no_such_object_error_raised_by_get_dobj(...)

NoSuchObjectError is raised when verb code calls get_dobj() but no object by that name exists in scope.

test_no_such_preposition_error_caught_by_parse_command(...)

tasks.parse_command catches NoSuchPrepositionError and formats it as bold red.

test_no_such_preposition_error_raised_by_verb(...)

NoSuchPrepositionError is raised when verb code calls get_pobj_str() for a preposition that was not present in the command.

test_no_such_preposition_error_str()

NoSuchPrepositionError.__str__ returns the user-facing message.

test_no_such_property_error_caught_by_parse_command(...)

tasks.parse_command catches NoSuchPropertyError and formats it as bold red.

test_no_such_property_error_is_user_error()

NoSuchPropertyError is a UserError subclass and str() contains the name.

test_no_such_property_error_raised_by_get_property(...)

NoSuchPropertyError is raised when verb code calls get_property() for a property that does not exist on this or any ancestor.

test_no_such_property_error_with_origin()

NoSuchPropertyError with origin includes origin in str().

test_no_such_verb_error_caught_by_parse_command(...)

tasks.parse_command catches NoSuchVerbError and formats it as bold red.

test_no_such_verb_error_is_user_error()

NoSuchVerbError is a UserError subclass; .data stores the verb name.

test_no_such_verb_error_raised_by_parser(...)

NoSuchVerbError is raised by the parser when no object has a matching verb and the location has no huh verb to fall back to.

test_parse_command_includes_error_prefix_when_prefixes_on(...)

With prefixes_mode=True, error output contains the [ERROR] tag.

test_parse_command_omits_error_prefix_when_prefixes_off(...)

Without prefixes_mode set, error output does not contain [ERROR] tag.

test_parse_command_returns_exit_status_one_on_no_such_verb(...)

NoSuchVerbError sets exit_status=1.

test_parse_command_returns_exit_status_one_on_user_error(...)

UserError raises exit_status=1.

test_parse_command_returns_exit_status_zero_on_success(...)

A successful command sets exit_status=0.

test_quota_error_caught_by_parse_command(...)

tasks.parse_command catches QuotaError and formats it as bold red.

test_quota_error_raised_by_create(t_init, ...)

QuotaError is raised by create() when the caller's quota is exhausted.

test_quota_error_str()

QuotaError.__str__ returns the message.

test_recursive_error_raised_on_containment_loop(...)

RecursiveError is raised by Object.save() when moving an object would create a containment loop (box contains inner, then box.location = inner).

test_recursive_error_str()

RecursiveError.__str__ returns the message.

test_usage_error_str()

UsageError.__str__ returns the usage message.

test_user_error_str()

UserError.__str__ returns the message.