Exemplo n.º 1
0
def test_remove_obj_from_parent_last_child_v5(
        zork_v5_obj_table: ZMachineObjectTable):
    zork_v5_obj_table.remove_obj_from_parent(127)
    west_of_house_tree = zork_v5_obj_table.obj_tree(68)

    assert len(west_of_house_tree['children']) == 1
    assert west_of_house_tree['children'][0]['number'] == 239

    door_obj = zork_v5_obj_table.object(127)
    assert door_obj.parent == 0
    assert door_obj.sibling == 0
Exemplo n.º 2
0
def test_remove_obj_from_parent_last_child_v3(
        zork_v3_obj_table: ZMachineObjectTable):
    zork_v3_obj_table.remove_obj_from_parent(160)
    west_of_house_tree = zork_v3_obj_table.obj_tree(180)

    assert len(west_of_house_tree['children']) == 1
    assert west_of_house_tree['children'][0]['number'] == 181

    small_mailbox_obj = zork_v3_obj_table.object(160)
    assert small_mailbox_obj.parent == 0
    assert small_mailbox_obj.sibling == 0
Exemplo n.º 3
0
def test_remove_obj_from_parent_first_child_v5(
        zork_v5_obj_table: ZMachineObjectTable):
    zork_v5_obj_table.remove_obj_from_parent(239)
    west_of_house_tree = zork_v5_obj_table.obj_tree(68)

    assert len(west_of_house_tree['children']) == 1
    assert west_of_house_tree['children'][0]['number'] == 127

    small_mailbox_obj = zork_v5_obj_table.object(239)
    assert small_mailbox_obj.parent == 0, 'object should no longer have a parent'
    assert small_mailbox_obj.sibling == 0, 'object should no longer have a sibling'
Exemplo n.º 4
0
def test_remove_obj_from_parent_first_child_v3(
        zork_v3_obj_table: ZMachineObjectTable):
    zork_v3_obj_table.remove_obj_from_parent(181)
    west_of_house_tree = zork_v3_obj_table.obj_tree(180)

    assert len(west_of_house_tree['children']) == 1
    assert west_of_house_tree['children'][0]['number'] == 160

    door_obj = zork_v3_obj_table.object(181)
    assert door_obj.parent == 0, 'object should no longer have a parent'
    assert door_obj.sibling == 0, 'object should no longer have a sibling'
Exemplo n.º 5
0
def test_remove_obj_from_parent_middle_child_v5(
        zork_v5_obj_table: ZMachineObjectTable):
    zork_v5_obj_table.remove_obj_from_parent(203)
    maintenance_room_tree = zork_v5_obj_table.obj_tree(233)

    assert len(maintenance_room_tree['children']) == 8
    assert maintenance_room_tree['children'][0]['number'] == 245
    assert maintenance_room_tree['children'][1]['number'] == 120

    tube_obj = zork_v5_obj_table.object(203)
    assert tube_obj.parent == 0
    assert tube_obj.sibling == 0
Exemplo n.º 6
0
def test_remove_obj_from_parent_middle_child_v3(
        zork_v3_obj_table: ZMachineObjectTable):
    zork_v3_obj_table.remove_obj_from_parent(91)
    maintenance_room_tree = zork_v3_obj_table.obj_tree(199)

    assert len(maintenance_room_tree['children']) == 8
    assert maintenance_room_tree['children'][0]['number'] == 200
    assert maintenance_room_tree['children'][1]['number'] == 99

    wrench_obj = zork_v3_obj_table.object(91)
    assert wrench_obj.parent == 0
    assert wrench_obj.sibling == 0