Exemplo n.º 1
0
def test_retrieve():
    sheet = Sheet("3", *three_faces_sheet())
    history = History(sheet)
    sheet_ = history.retrieve(0)
    for elem, dset in sheet_.datasets.items():
        assert dset.shape[0] == sheet.datasets[elem].shape[0]
    assert "area" in sheet_.datasets["face"].columns
    with pytest.warns(UserWarning):
        sheet_ = history.retrieve(1)
    for elem, dset in sheet_.datasets.items():
        assert dset.shape[0] == sheet.datasets[elem].shape[0]

    sheet.vert_df.loc[0, "x"] = 100.0
    sheet.face_df["area"] = 100.0
    history.record()
    sheet_ = history.retrieve(1)
    for elem, dset in sheet_.datasets.items():
        assert dset.shape[0] == sheet.datasets[elem].shape[0]
        print(dset)
    assert sheet_.datasets["vert"].loc[0, "x"] == 100.0
    assert sheet_.datasets["face"].loc[0, "area"] == 100.0
    history.record()
    sheet_ = history.retrieve(2)
    assert sheet_.datasets["face"].loc[0, "area"] == 100.0
    sheet_ = history.retrieve(1)
    assert sheet_.datasets["face"].loc[0, "area"] == 100.0
Exemplo n.º 2
0
def test_retrieve():
    sheet = Sheet("3", *three_faces_sheet())
    history = History(sheet, {"face": ["area"]})
    sheet_ = history.retrieve(0)
    for elem, dset in sheet_.datasets.items():
        assert dset.shape[0] == sheet.datasets[elem].shape[0]
    assert "area" in sheet_.datasets["face"].columns
    sheet_ = history.retrieve(1)
    for elem, dset in sheet_.datasets.items():
        assert dset.shape[0] == sheet.datasets[elem].shape[0]

    sheet.vert_df.loc[0, "x"] = 100
    sheet.face_df["area"] = 100
    history.record()
    sheet_ = history.retrieve(1)
    for elem, dset in sheet_.datasets.items():
        assert dset.shape[0] == sheet.datasets[elem].shape[0]
        print(dset)
    assert sheet_.datasets["vert"].loc[0, "x"] == 100
    assert sheet_.datasets["face"].loc[0, "area"] != 100
    history.record(["vert", "face"])
    sheet_ = history.retrieve(2)
    assert sheet_.datasets["face"].loc[0, "area"] == 100
    sheet_ = history.retrieve(1)
    assert sheet_.datasets["face"].loc[0, "area"] != 100
Exemplo n.º 3
0
def test_retrieve_bulk():
    eptm = Epithelium("3", extrude(three_faces_sheet()[0]))
    RNRGeometry.update_all(eptm)

    history = History(eptm)
    eptm_ = history.retrieve(0)
    RNRGeometry.update_all(eptm_)
Exemplo n.º 4
0
def test_overwrite_time():
    sheet = Sheet("3", *three_faces_sheet())
    history = History(sheet)
    history.record(time_stamp=1)
    history.record(time_stamp=1)
    sheet_ = history.retrieve(1)
    assert sheet_.Nv == sheet.Nv
Exemplo n.º 5
0
def test_retrieve_coords():
    sheet = Sheet("3", *three_faces_sheet())
    history = History(sheet)
    history.record()
    assert history.retrieve(0).coords == sheet.coords