mud/tests/test_portal.py
Jared Miller 37d1c86b34
Delete trivial constructor and property tests
Removed 32 tests that only verified constructor args are stored as
properties. Type annotations and behavioral tests already cover this.
2026-02-16 16:10:38 -05:00

48 lines
1.3 KiB
Python

"""Tests for the Portal class."""
from mudlib.object import Object
from mudlib.portal import Portal
from mudlib.thing import Thing
from mudlib.zone import Zone
# --- construction ---
def test_portal_forced_non_portable():
"""Portal forces portable=False even if explicitly set True."""
# Even if we try to make it portable, it should be forced to False
p = Portal(name="portal", portable=True)
assert p.portable is False
def test_portal_in_zone():
"""Portal can exist in a zone with coordinates."""
terrain = [["." for _ in range(10)] for _ in range(10)]
zone = Zone(name="test", width=10, height=10, terrain=terrain)
p = Portal(
name="gateway",
location=zone,
x=3,
y=7,
target_zone="dungeon",
target_x=5,
target_y=5,
)
assert p.location is zone
assert p.x == 3
assert p.y == 7
assert p in zone.contents
def test_portal_rejects_contents():
"""Portal cannot accept other objects (uses Thing's default behavior)."""
p = Portal(name="portal")
obj = Object(name="rock")
assert p.can_accept(obj) is False
def test_portal_rejects_things():
"""Portal cannot accept things."""
p = Portal(name="portal")
thing = Thing(name="sword")
assert p.can_accept(thing) is False