本文整理汇总了Python中pxr.Tf._TakesBase方法的典型用法代码示例。如果您正苦于以下问题:Python Tf._TakesBase方法的具体用法?Python Tf._TakesBase怎么用?Python Tf._TakesBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pxr.Tf
的用法示例。
在下文中一共展示了Tf._TakesBase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_BaseDerived
# 需要导入模块: from pxr import Tf [as 别名]
# 或者: from pxr.Tf import _TakesBase [as 别名]
def test_BaseDerived(self):
mb = MyBase()
d = Tf._TestDerived()
md = MyDerived()
self.assertEqual('unwrapped virtual', mb.TestCallVirtual())
self.assertEqual('cpp base', mb.Virtual4())
self.assertEqual('python derived v4', md.Virtual4())
self.assertEqual((False, 'python base'), Tf._TakesBase(mb))
self.assertEqual((True, 'cpp derived'), Tf._TakesBase(d))
self.assertEqual((True, 'python derived'), Tf._TakesBase(md))
self.assertEqual('python base', Tf._TakesConstBase(mb))
self.assertEqual('cpp derived', Tf._TakesConstBase(d))
self.assertEqual('python derived', Tf._TakesConstBase(md))
self.assertEqual('cpp derived', Tf._TakesDerived(d))
self.assertEqual('python derived', Tf._TakesDerived(md))
self.assertIs(Tf._ReturnsConstBase(md), md)
self.assertIs(Tf._ReturnsBase(md), md)
self.assertIs(Tf._ReturnsBaseRefPtr(md), md)
try:
Tf._TestBase().Virtual()
assert False, 'calling pure virtual'
except:
pass
示例2: test_Exception
# 需要导入模块: from pxr import Tf [as 别名]
# 或者: from pxr.Tf import _TakesBase [as 别名]
def test_Exception(self):
with self.assertRaises(RuntimeError):
Tf._TakesBase(Raiser())
with self.assertRaises(Tf.ErrorException) as cm:
Tf._mightRaise(True)
for x in cm.exception:
self.assertTrue(len(repr(x)))
with self.assertRaises(Tf.ErrorException):
Tf.RaiseCodingError("some error")
with self.assertRaises(Tf.ErrorException):
Tf.RaiseRuntimeError("some error")
with self.assertRaises(Tf.ErrorException):
Tf._doErrors()
示例3: test_Factory
# 需要导入模块: from pxr import Tf [as 别名]
# 或者: from pxr.Tf import _TakesBase [as 别名]
def test_Factory(self):
df = Tf._DerivedFactory()
self.assertIsInstance(df, Tf._TestDerived)
self.assertTrue(hasattr(df, '__owner'))
self.assertEqual((True, 'cpp derived'), Tf._TakesBase(df))
Tf._TakesReference(df)
self.assertFalse(hasattr(df, '__owner'))
self.assertIs(Tf._DerivedNullFactory(), None)