diff --git a/tests/test_hub_zone.py b/tests/test_hub_zone.py index 1c804d4..23b8e16 100644 --- a/tests/test_hub_zone.py +++ b/tests/test_hub_zone.py @@ -2,6 +2,7 @@ import pathlib +from mudlib.portal import Portal from mudlib.zones import load_zone @@ -28,7 +29,7 @@ def test_hub_zone_has_portals(): zone = load_zone(hub_path) # Find portals in zone contents - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] assert len(portals) == 3 # Check that we have portals to each target zone @@ -43,7 +44,7 @@ def test_hub_zone_portals_at_correct_positions(): zone = load_zone(hub_path) - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] # North portal to overworld at (7, 0) overworld_portal = [p for p in portals if p.target_zone == "overworld"][0] diff --git a/tests/test_tutorial_zones.py b/tests/test_tutorial_zones.py index e19bd31..5f46c24 100644 --- a/tests/test_tutorial_zones.py +++ b/tests/test_tutorial_zones.py @@ -2,6 +2,7 @@ import pathlib +from mudlib.portal import Portal from mudlib.zones import load_zone @@ -59,7 +60,7 @@ def test_flower_has_portal_to_treehouse(): zone = load_zone(flower_path) # Find portals in zone contents - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] assert len(portals) == 1 portal = portals[0] @@ -93,7 +94,7 @@ def test_treehouse_has_portal_to_overworld(): zone = load_zone(treehouse_path) # Find portals - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] # Find the overworld portal overworld_portals = [p for p in portals if p.target_zone == "overworld"] @@ -113,7 +114,7 @@ def test_treehouse_has_portal_to_hub(): zone = load_zone(treehouse_path) # Find portals - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] # Find the hub portal hub_portals = [p for p in portals if p.target_zone == "hub"] diff --git a/tests/test_zone_export.py b/tests/test_zone_export.py index ad7356d..693065e 100644 --- a/tests/test_zone_export.py +++ b/tests/test_zone_export.py @@ -195,9 +195,7 @@ def test_export_zone_with_portals_round_trip(): assert loaded.height == zone.height # Verify portals were loaded correctly - portals = [ - obj for obj in loaded._contents if obj.__class__.__name__ == "Portal" - ] + portals = [obj for obj in loaded._contents if isinstance(obj, Portal)] assert len(portals) == 2 # Sort by y coordinate for consistent ordering diff --git a/tests/test_zone_loading.py b/tests/test_zone_loading.py index 7ddf2fc..9611985 100644 --- a/tests/test_zone_loading.py +++ b/tests/test_zone_loading.py @@ -3,6 +3,7 @@ import pathlib import tempfile +from mudlib.portal import Portal from mudlib.zones import load_zone, load_zones @@ -254,7 +255,7 @@ label = "forest path" zone = load_zone(temp_path) # Find portals in zone contents - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] assert len(portals) == 2 # Check first portal (tavern door at 5,3) @@ -307,7 +308,7 @@ rows = [ zone = load_zone(temp_path) # Should have no portals - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] assert len(portals) == 0 finally: temp_path.unlink() @@ -343,7 +344,7 @@ aliases = ["gateway", "gate", "portal"] try: zone = load_zone(temp_path) - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] assert len(portals) == 1 portal = portals[0] @@ -361,7 +362,7 @@ def test_tavern_has_portal_to_hub(): zone = load_zone(tavern_path) # Find portals in zone - portals = [obj for obj in zone._contents if obj.__class__.__name__ == "Portal"] + portals = [obj for obj in zone._contents if isinstance(obj, Portal)] assert len(portals) == 1 # Check portal is at the door (4, 5) and leads to hub