Esempio n. 1
0
    def test_select_solvers(self):
        std = self.std
        find_servers = self.mocker.replace(astk.find_servers)
        data = (
            ("crater", "STA8.1 NEW9 STA10.1", "oui"),
            ("herc", "STA11.0", "non"),
        )
        servs = [{
            "nom_complet": name,
            "vers": vers,
            "batch": batch
        } for name, vers, batch in data]
        MCK.expect(find_servers()).result(servs).count(0, None)
        self.mocker.replay()

        creator = AM.add_study_case(self.mod)
        params = creator._params
        srv, vers, mode = [
            params[key] for key in ("server", "aster-version", "mode")
        ]
        self.assertEqual(mode._wid.count(), 2)
        srv._wid.setCurrentIndex(1)
        srv._wid.emit(SIG("activated(int)"), 1)
        self.assertEqual(str(vers._wid.currentText()), "STA11.0")
        self.assertEqual(mode._wid.count(), 1)

        case = std.add_case("c")
        params.build_case(std, case)

        cfg = case.get(aster_s.AstkParams)
        self.assertEqual(cfg["server"], "herc")
        self.assertEqual(cfg["aster-version"], "STA11.0")
Esempio n. 2
0
 def test_not_add_case_if_name_already_exists(self):
     creators = [AM.add_study_case(self.mod) for idx in range(2)]
     for creator in creators:
         creator._name.setText("case")
     creators[0].build_case()
     self.assertEqual(len(self.std.get_all(aster_s.Case)), 1)
     creators[1].build_case()
     self.assertEqual(len(self.std.get_all(aster_s.Case)), 1)
Esempio n. 3
0
 def test_not_add_case_if_name_is_empty(self):
     parent = self.mod.give_qtwid()
     creator = AM.add_study_case(self.mod)
     creator._name.setText("")
     cnb = len(parent.children())
     creator.build_case()
     self.assertEqual(len(parent.children()), cnb + 1)
     self.assertEqual(len(self.std.get_all(aster_s.Case)), 0)
Esempio n. 4
0
 def test_add_case_with_comm_and_mesh_files(self):
     creator = AM.add_study_case(self.mod)
     params = creator._params
     data = (
         ("comm", "/aster/f.comm"),
         ("mesh", "f.mmed"),
     )
     for key, val in data:
         params[key]._data_builder.fname_entry.setText(val)
     creator.build_case()
     case = self.std.get_all(aster_s.Case)[0]
     fnames = [case.get(ftype).read_fname() \
               for ftype in (aster_s.CommFile, aster_s.MedFile)]
Esempio n. 5
0
    def test_modify_astk_parameters(self):
        std = self.std

        creator = AM.add_study_case(self.mod)
        params = creator._params
        params["memory"]._wid.setValue(1024)
        params["mode"]._wid.setCurrentIndex(1)
        case = std.add_case("c")
        params.build_case(std, case)

        cfg = case.get(aster_s.AstkParams)
        self.assertEqual(cfg["memory"], 1024)
        self.assertEqual(cfg["mode"], "batch")
Esempio n. 6
0
    def test_use_interactiv_and_base_result(self):
        std = self.std
        creator = AM.add_study_case(self.mod)
        params = creator._params
        boxes = [
            params["interactiv-follow-up"]._active,
            params["save-base"]._wid,
        ]
        for box in boxes:
            box.checked(True)

        case = std.add_case("c")
        params.build_case(std, case)

        self.assert_(case.get(aster_s.InteractivFollowUp))
        self.assert_(case.get(aster_s.HasBaseResult))
Esempio n. 7
0
 def test_add_case_with_comm_and_mesh_entries(self):
     std = self.std
     comm = aster_s.CommFile("f.comm").build(std)
     mesh = std.sstd.load_meshes_from(self.med_fname)[0]
     data = (
         ("comm", comm.node),
         ("mesh", mesh.node),
     )
     creator = AM.add_study_case(self.mod)
     params = creator._params
     for key, node in data:
         params[key]._data_builder._brw_node = node
     creator.build_case()
     case = self.std.get_all(aster_s.Case)[0]
     self.assert_(case.get(aster_s.CommEntry))
     self.assert_(case.get(aster_s.SMeshEntry))
Esempio n. 8
0
    def test_add_case_with_eficas_and_med_file_entry(self):
        import aster_s.salome_tree as stree
        std = self.std
        # Adding fake eficas file
        fname = "/aster/case1/eficas-file.comm"
        eficas_node = std.sstd.add_root("eficas-file")
        eficas_node.get_attr(stree.Value).write(fname)
        eficas_node.get_attr(stree.Type).write(stree.EficasFile.ftype)
        med = aster_s.MedFile("f.mmed").build(std)

        creator = AM.add_study_case(self.mod)
        blds = [creator._params[key]._data_builder for key in ("comm", "mesh")]
        blds[0]._brw_node = eficas_node
        blds[1]._brw_node = med.node
        creator.build_case()
        case = self.std.get_all(aster_s.Case)[0]
        comm = case.get(aster_s.CommFile)
        self.assert_(comm.read_fname(), fname)
        self.assert_(case.get(aster_s.MedEntry))
Esempio n. 9
0
 def test_add_cases(self):
     for idx in range(3):
         creator = AM.add_study_case(self.mod)
         creator._name.setText("case%i" % idx)
         creator.build_case()
     self.assertEqual(len(self.std.get_all(aster_s.Case)), 3)