Salome HOME
Updated copyright comment
[modules/shaper.git] / src / ModelHighAPI / Test / TestRefAttr.py
1 # Copyright (C) 2014-2024  CEA, EDF
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 import unittest
21
22 import ModelAPI
23 import ModelHighAPI
24 from salome.shaper import model
25
26 class FeaturesFixture(unittest.TestCase):
27
28     def setUp(self):
29         model.begin()
30         # Create part
31         partset = model.moduleDocument()
32         self.part = model.addPart(partset).document()
33         model.do()
34         self.feature = model.addPoint(self.part, 0, 0, 0)
35
36     def tearDown(self):
37         model.end()
38         model.reset()
39
40
41 class RefAttrTestCase(FeaturesFixture):
42
43     def test_create_default(self):
44         ModelHighAPI.ModelHighAPI_RefAttr()
45
46     def test_create_from_attribute(self):
47         print(self.feature.point())
48         ModelHighAPI.ModelHighAPI_RefAttr(self.feature.point())
49
50     def test_create_from_object(self):
51         ModelHighAPI.ModelHighAPI_RefAttr(self.feature.feature())
52
53     def test_create_from_None(self):
54         ModelHighAPI.ModelHighAPI_RefAttr(None)
55
56
57 if __name__ == "__main__":
58     test_program = unittest.main(exit=False)
59     assert test_program.result.wasSuccessful(), "Test failed"