Exemplo n.º 1
0
def test_vector_from_string():
    assert Vector.from_string('1,2,3') == Vector(1, 2, 3)
    assert Vector.from_string('1, 2, 3') == Vector(1, 2, 3)
    with pytest.raises(ValueError):
        Vector.from_string('1')
    with pytest.raises(ValueError):
        Vector.from_string('(1,2,3)')
Exemplo n.º 2
0
def test_blocks_set_one():
    conn = mock.MagicMock()
    picraft.block.Blocks(conn)[Vector(1, 2, 3)] = Block(0, 0)
    conn.send.assert_called_once_with('world.setBlock(1,2,3,0,0)')
Exemplo n.º 3
0
def test_blocks_set_many_same():
    conn = mock.MagicMock()
    v_from = Vector(1, 2, 3)
    v_to = Vector(2, 3, 5)
    picraft.block.Blocks(conn)[v_from:v_to] = Block(0, 0)
    conn.send.assert_called_once_with('world.setBlocks(1,2,3,1,2,4,0,0)')
Exemplo n.º 4
0
def test_blocks_get_one():
    conn = mock.MagicMock()
    conn.transact.return_value = '1,1'
    assert picraft.block.Blocks(conn)[Vector(1, 2, 3)] == Block(1, 1)
    conn.transact.assert_called_once_with('world.getBlockWithData(1,2,3)')