Salome HOME
Added python dump checking for every unit test where it is useful.
[modules/shaper.git] / src / ConstructionAPI / Test / TestPoint.py
1 import unittest
2
3 import ModelAPI
4 import ConstructionAPI
5 import model
6
7 class PointTestCase(unittest.TestCase):
8
9     def setUp(self):
10         self.session = ModelAPI.ModelAPI_Session.get()
11         self.doc = self.session.moduleDocument()
12         self.session.startOperation()
13         self.feature = self.doc.addFeature("Point")
14         self.feature.execute()
15         self.session.finishOperation()
16
17     def tearDown(self):
18         assert(model.checkPythonDump())
19         self.session.closeAll()
20
21     def test_ConstructorWithValues(self):
22         point = ConstructionAPI.ConstructionAPI_Point(self.feature, 10, "20", "x + 30")
23         #self.assertEqual(10, point.x().value())
24         #self.assertEqual("20", point.y().text())
25         #self.assertEqual("x + 30", point.z().text())
26
27     def test_setValue(self):
28         point = ConstructionAPI.ConstructionAPI_Point(self.feature)
29         self.assertEqual(0, point.x().value())
30         self.assertEqual(0, point.y().value())
31         self.assertEqual(0, point.z().value())
32
33         point.setByXYZ(10, "20", "x + 30")
34         self.assertEqual(10, point.x().value())
35         self.assertEqual("20", point.y().text())
36         self.assertEqual("x + 30", point.z().text())
37
38 if __name__ == "__main__":
39     unittest.main()