Exemplo n.º 1
0
def test_dict_to_object_view():
    """Test the dict_to_object method with View objects."""
    v_obj = View('test_view', (0, 0, 10), (0, 1, 0), (0, 0, 1), 'l', 240, 300,
                 -10, -25)
    v_dict = v_obj.to_dict()
    new_v = dict_to_object(v_dict)
    assert isinstance(new_v, View)
Exemplo n.º 2
0
def test_to_from_dict():
    view = View('test_view', (0, 0, 10), (0, 1, 0), (0, 0, 1), 'l', 240, 300,
                -10, -25)
    view.room_identifier = 'Test_room'

    view_dict = view.to_dict()
    new_view = View.from_dict(view_dict)
    assert new_view == view
    assert view_dict == new_view.to_dict()
Exemplo n.º 3
0
def view_parallel(directory):
    vw = View('test_view', (0, 0, 10), (0, 1, 0), (0, 0, 1), 'l', 240, 300, -10, -25)
    dest_file = os.path.join(directory, 'view_parallel.json')
    with open(dest_file, 'w') as fp:
        json.dump(vw.to_dict(), fp, indent=4)
Exemplo n.º 4
0
def view_perspective(directory):
    vw = View('test_view_perspective', (0, 0, 10), (0, 1, 0), (0, 0, 1))
    dest_file = os.path.join(directory, 'view_perspective.json')
    with open(dest_file, 'w') as fp:
        json.dump(vw.to_dict(), fp, indent=4)