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)
         self.assertFalse(h.IsNull())
 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_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.)
Ejemplo n.º 4
0
 def test_deprecation_downcasts(self):
     t = Standard_Transient()
     with assert_warns_deprecated():
         Handle_Standard_Transient.DownCast(t)
 def evil_function(t):
     handle = Handle_Standard_Transient(t)
 def test_deprecation_downcasts(self):
     t = Standard_Transient()
     with assert_warns_deprecated():
         h = Handle_Standard_Transient.DownCast(t)
         self.assertFalse(h.IsNull())