Ejemplo n.º 1
0
 def test_deprecation_get_object(self):
     """ Handles are now completely transparent. The GetObject method is
     not required anymore.
     """
     t = Standard_Transient()
     with assert_warns_deprecated():
         t.GetObject()
 def test_hash(self):
     '''
     Check whether the __hash__ function is equal to HashCode()
     '''
     s = Standard_Transient()
     id_s = id(s)
     hash1_s = s.__hash__()
     self.assertNotEqual(id_s, hash1_s)
 def test_hash(self):
     '''
     Check whether the __hash__ function is equal to HashCode()
     '''
     s = Standard_Transient()
     id_s = id(s)
     hash1_s = s.__hash__()
     self.assertNotEqual(id_s, hash1_s)
 def test_deprecation_get_handle(self):
     """ Handles are now completely transparent. The GetHandle method is
     not required anymore.
     """
     t = Standard_Transient()
     with assert_warns_deprecated():
         h = t.GetHandle()
         self.assertFalse(h.IsNull())
 def test_neq_operator(self):
     # test Standard
     s = Standard_Transient()
     s2 = Standard_Transient()
     self.assertTrue(s != s2)
     self.assertFalse(s != s)
     shape_1 = BRepPrimAPI_MakeBox(10, 20, 30).Shape()
     shape_2 = BRepPrimAPI_MakeBox(10, 20, 30).Shape()
     self.assertTrue(shape_1 != shape_2)
     self.assertFalse(shape_1 != shape_1)
     self.assertTrue(shape_1 != "some_string")
 def test_hash_eq_operator(self) -> None:
     """test that the == wrapper is ok"""
     # test Standard
     s = Standard_Transient()
     s2 = Standard_Transient()
     self.assertFalse(s == s2)
     self.assertTrue(s == s)
     # test list.index, that uses __eq__ method
     p1 = gp_Pnt(0.0, 0.0, 0.0)
     line = gp_Lin(p1, gp_Dir(1.0, 0.0, 0.0))
     items = [p1, line]
     res = items.index(line)
     self.assertEqual(res, 1.0)
 def test_neq_operator(self):
     # test Standard
     h1 = Handle_Standard_Transient()
     s = Standard_Transient()
     h2 = s.GetHandle()
     self.assertFalse(h1 != h1)
     self.assertTrue(h1 != h2)
     self.assertTrue(h1 != 10)
     self.assertFalse(h2 != s)
     shape_1 = BRepPrimAPI_MakeBox(10, 20, 30).Shape()
     shape_2 = BRepPrimAPI_MakeBox(10, 20, 30).Shape()
     self.assertTrue(shape_1 != shape_2)
     self.assertFalse(shape_1 != shape_1)
     self.assertTrue(shape_1 != "some_string")
 def test_handle_standard_transient_copy(self) -> None:
     def evil_function(t: Standard_Transient) -> Standard_Transient:
         handle = Standard_Transient(t)
         return handle
     t = Standard_Transient()
     self.assertIsNotNone(t)
     self.assertIsNotNone(evil_function(t))
Ejemplo n.º 9
0
    def test_handle_standard_transient_copy(self):
        def evil_function(t):
            handle = Standard_Transient(t)
            return handle

        t = Standard_Transient()
        evil_function(t)
Ejemplo n.º 10
0
 def test_deprecation_handle_class(self):
     """ Handles are now completely transparent. The Handle_* constructor is
     not required anymore.
     """
     t = Standard_Transient()
     with assert_warns_deprecated():
         h = Handle_Standard_Transient(t)
 def test_hash_eq_operator(self):
     ''' test that the == wrapper is ok
     '''
     # test Standard
     h1 = Handle_Standard_Transient()
     s = Standard_Transient()
     h2 = s.GetHandle()
     self.assertTrue(h1 == h1)
     self.assertFalse(h1 == h2)
     self.assertFalse(h1 == 10)
     self.assertTrue(h2 == s)
     # test list.index, that uses __eq__ method
     p1 = gp_Pnt(0., 0., 0.)
     line = gp_Lin(p1, gp_Dir(1., 0., 0.))
     items = [p1, line]
     res = items.index(line)
     self.assertEqual(res, 1.)
 def evil_function(t):
     handle = Standard_Transient(t)
     return handle
Ejemplo n.º 13
0
 def test_deprecation_downcasts(self):
     t = Standard_Transient()
     with assert_warns_deprecated():
         Handle_Standard_Transient.DownCast(t)
 def test_deprecation_downcasts(self):
     t = Standard_Transient()
     with assert_warns_deprecated():
         h = Handle_Standard_Transient.DownCast(t)
         self.assertFalse(h.IsNull())