From b838eceb5b42c6471892da0fb1c47d5bbd4b5f75 Mon Sep 17 00:00:00 2001 From: asozinov Date: Fri, 27 Jan 2023 13:57:50 +0300 Subject: [PATCH] test sketch fix --- .../SAMConverter_SuggestConstraintsFeature.py | 3 ++- src/SAMConverter/Test/TestSAMConverter_Sketch.py | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py b/src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py index b26355c4c..9f7f61ad2 100644 --- a/src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py +++ b/src/SAMConverter/SAMConverter_SuggestConstraintsFeature.py @@ -376,6 +376,7 @@ class SuggestConstraintsFeature(ModelAPI.ModelAPI_Feature): return predicted_list = ai_class_inst.Predict(self.exchange_sketch) - self.fillAttributes(predicted_list) + if salome.sg.hasDesktop(): + self.fillAttributes(predicted_list) return predicted_list diff --git a/src/SAMConverter/Test/TestSAMConverter_Sketch.py b/src/SAMConverter/Test/TestSAMConverter_Sketch.py index db9258f77..7273f7ce6 100644 --- a/src/SAMConverter/Test/TestSAMConverter_Sketch.py +++ b/src/SAMConverter/Test/TestSAMConverter_Sketch.py @@ -36,13 +36,11 @@ from SAMConverter_ConvertConstraints import * from SAMConverter_ConvertPrimitives import * from SAMConverter_ConvertSketch import * -def test_dictionary_valid(self, sketch_object_list, dictionary): - pass - class TestConvertSketch(unittest.TestCase): def test_convert_sketch(self): model.begin() partSet = model.moduleDocument() + Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ")) @@ -73,7 +71,9 @@ class TestConvertSketch(unittest.TestCase): object_list.append(SketchRadius_1) object_list.append(SketchRadius_2) - exchange_elements, dictionary = SAMConverter_ConvertSketch.convert_sketch(Sketch_1) + exchange_elements, dictionary = convert_sketch(Sketch_1) + + self.assertEqual(len(object_list), len(exchange_elements.sequence)) -- 2.39.2