From 5b3291e4eeae611ba49824985f095859afb706ed Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 7 May 2020 23:08:43 +0200 Subject: [PATCH] Updated tests to work with new project tree class --- ...b6561_main.nwd => 1_8010bd9270f9_main.nwd} | 0 ...52555_main.nwd => 1_a6562590ef19_main.nwd} | 0 ...7e394_main.nwd => 1_e17daca5f3e1_main.nwd} | 0 tests/reference/gui/1_nwProject.nwx | 8 ++--- tests/reference/proj/2_nwProject.nwx | 10 +++---- tests/test_gui.py | 30 +++++++++---------- tests/test_project.py | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) rename tests/reference/gui/{1_fca346db6561_main.nwd => 1_8010bd9270f9_main.nwd} (100%) rename tests/reference/gui/{1_688b6ef52555_main.nwd => 1_a6562590ef19_main.nwd} (100%) rename tests/reference/gui/{1_2d20bbd7e394_main.nwd => 1_e17daca5f3e1_main.nwd} (100%) diff --git a/tests/reference/gui/1_fca346db6561_main.nwd b/tests/reference/gui/1_8010bd9270f9_main.nwd similarity index 100% rename from tests/reference/gui/1_fca346db6561_main.nwd rename to tests/reference/gui/1_8010bd9270f9_main.nwd diff --git a/tests/reference/gui/1_688b6ef52555_main.nwd b/tests/reference/gui/1_a6562590ef19_main.nwd similarity index 100% rename from tests/reference/gui/1_688b6ef52555_main.nwd rename to tests/reference/gui/1_a6562590ef19_main.nwd diff --git a/tests/reference/gui/1_2d20bbd7e394_main.nwd b/tests/reference/gui/1_e17daca5f3e1_main.nwd similarity index 100% rename from tests/reference/gui/1_2d20bbd7e394_main.nwd rename to tests/reference/gui/1_e17daca5f3e1_main.nwd diff --git a/tests/reference/gui/1_nwProject.nwx b/tests/reference/gui/1_nwProject.nwx index 02119a65..c55ff681 100644 --- a/tests/reference/gui/1_nwProject.nwx +++ b/tests/reference/gui/1_nwProject.nwx @@ -1,5 +1,5 @@ - + @@ -59,7 +59,7 @@ New True - + New File FILE CHARACTER @@ -78,7 +78,7 @@ New True - + New File FILE PLOT @@ -97,7 +97,7 @@ New True - + New File FILE WORLD diff --git a/tests/reference/proj/2_nwProject.nwx b/tests/reference/proj/2_nwProject.nwx index a40a2e8d..92bd9df4 100644 --- a/tests/reference/proj/2_nwProject.nwx +++ b/tests/reference/proj/2_nwProject.nwx @@ -1,5 +1,5 @@ - + @@ -73,28 +73,28 @@ 0 0 - + Timeline ROOT TIMELINE New False - + Object ROOT OBJECT New False - + Custom1 ROOT CUSTOM New False - + Custom2 ROOT CUSTOM diff --git a/tests/test_gui.py b/tests/test_gui.py index c8f8d013..e2291fff 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -25,15 +25,15 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp): qtbot.wait(stepDelay) # Create new, save, close project - nwGUI.theProject.handleSeed = 42 + nwGUI.theProject.projTree.setSeed(42) assert nwGUI.newProject(nwTempGUI, True) assert nwGUI.saveProject() assert nwGUI.closeProject() assert len(nwGUI.theProject.projTree) == 0 - assert len(nwGUI.theProject.treeOrder) == 0 - assert len(nwGUI.theProject.treeRoots) == 0 - assert nwGUI.theProject.trashRoot is None + assert len(nwGUI.theProject.projTree._treeOrder) == 0 + assert len(nwGUI.theProject.projTree._treeRoots) == 0 + assert nwGUI.theProject.projTree.trashRoot() is None assert nwGUI.theProject.projPath is None assert nwGUI.theProject.projMeta is None assert nwGUI.theProject.projFile == "nwProject.nwx" @@ -55,9 +55,9 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp): # Check that we loaded the data assert len(nwGUI.theProject.projTree) == 6 - assert len(nwGUI.theProject.treeOrder) == 6 - assert len(nwGUI.theProject.treeRoots) == 4 - assert nwGUI.theProject.trashRoot is None + assert len(nwGUI.theProject.projTree._treeOrder) == 6 + assert len(nwGUI.theProject.projTree._treeRoots) == 4 + assert nwGUI.theProject.projTree.trashRoot() is None assert nwGUI.theProject.projPath == nwTempGUI assert nwGUI.theProject.projMeta == path.join(nwTempGUI,"meta") assert nwGUI.theProject.projFile == "nwProject.nwx" @@ -237,14 +237,14 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp): # Check the files refFile = path.join(nwTempGUI,"nwProject.nwx") assert cmpFiles(refFile, path.join(nwRef,"gui","1_nwProject.nwx"), [2]) - refFile = path.join(nwTempGUI,"data_0","2d20bbd7e394_main.nwd") - assert cmpFiles(refFile, path.join(nwRef,"gui","1_2d20bbd7e394_main.nwd")) - refFile = path.join(nwTempGUI,"data_2","fca346db6561_main.nwd") - assert cmpFiles(refFile, path.join(nwRef,"gui","1_fca346db6561_main.nwd")) + refFile = path.join(nwTempGUI,"data_0","e17daca5f3e1_main.nwd") + assert cmpFiles(refFile, path.join(nwRef,"gui","1_e17daca5f3e1_main.nwd")) + refFile = path.join(nwTempGUI,"data_9","8010bd9270f9_main.nwd") + assert cmpFiles(refFile, path.join(nwRef,"gui","1_8010bd9270f9_main.nwd")) refFile = path.join(nwTempGUI,"data_3","1489056e0916_main.nwd") assert cmpFiles(refFile, path.join(nwRef,"gui","1_1489056e0916_main.nwd")) - refFile = path.join(nwTempGUI,"data_7","688b6ef52555_main.nwd") - assert cmpFiles(refFile, path.join(nwRef,"gui","1_688b6ef52555_main.nwd")) + refFile = path.join(nwTempGUI,"data_1","a6562590ef19_main.nwd") + assert cmpFiles(refFile, path.join(nwRef,"gui","1_a6562590ef19_main.nwd")) nwGUI.closeMain() # qtbot.stopForInteraction() @@ -258,7 +258,7 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp): qtbot.wait(stepDelay) # Create new, save, open project - nwGUI.theProject.handleSeed = 42 + nwGUI.theProject.projTree.setSeed(42) assert nwGUI.newProject(nwTempGUI, True) nwGUI.mainConf.backupPath = nwTempGUI @@ -345,7 +345,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp): qtbot.wait(stepDelay) # Create new, save, open project - nwGUI.theProject.handleSeed = 42 + nwGUI.theProject.projTree.setSeed(42) assert nwGUI.newProject(nwTempGUI, True) itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916") diff --git a/tests/test_project.py b/tests/test_project.py index 81301c4d..c029fbba 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -19,7 +19,7 @@ theMain = DummyMain() theMain.mainConf = theConf theProject = NWProject(theMain) -theProject.handleSeed = 42 +theProject.projTree.setSeed(42) @pytest.mark.project def testProjectNew(nwTempProj,nwRef,nwTemp):