本文整理汇总了Python中pxr.Tf._ClassWithVarArgInit方法的典型用法代码示例。如果您正苦于以下问题:Python Tf._ClassWithVarArgInit方法的具体用法?Python Tf._ClassWithVarArgInit怎么用?Python Tf._ClassWithVarArgInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pxr.Tf
的用法示例。
在下文中一共展示了Tf._ClassWithVarArgInit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StandardTests
# 需要导入模块: from pxr import Tf [as 别名]
# 或者: from pxr.Tf import _ClassWithVarArgInit [as 别名]
def StandardTests(allowExtraArgs):
CheckResults(Tf._ClassWithVarArgInit(allowExtraArgs),
allowExtraArgs, (), {})
CheckResults(Tf._ClassWithVarArgInit(allowExtraArgs, 1),
allowExtraArgs, (), {'a':1})
CheckResults(Tf._ClassWithVarArgInit(allowExtraArgs, 1, 2, 3),
allowExtraArgs, (), {'a':1, 'b':2, 'c':3})
CheckResults(Tf._ClassWithVarArgInit(allowExtraArgs, 1, 2, c=3),
allowExtraArgs, (), {'a':1, 'b':2, 'c':3})
示例2: test_TfMakePyConstructorWithVarArgs
# 需要导入模块: from pxr import Tf [as 别名]
# 或者: from pxr.Tf import _ClassWithVarArgInit [as 别名]
def test_TfMakePyConstructorWithVarArgs(self):
with self.assertRaises(TypeError):
Tf._ClassWithVarArgInit()
def CheckResults(c, allowExtraArgs, args, kwargs):
self.assertEqual(c.allowExtraArgs, allowExtraArgs)
self.assertEqual(c.args, args)
self.assertEqual(c.kwargs, kwargs)
def StandardTests(allowExtraArgs):
CheckResults(Tf._ClassWithVarArgInit(allowExtraArgs),
allowExtraArgs, (), {})
CheckResults(Tf._ClassWithVarArgInit(allowExtraArgs, 1),
allowExtraArgs, (), {'a':1})
CheckResults(Tf._ClassWithVarArgInit(allowExtraArgs, 1, 2, 3),
allowExtraArgs, (), {'a':1, 'b':2, 'c':3})
CheckResults(Tf._ClassWithVarArgInit(allowExtraArgs, 1, 2, c=3),
allowExtraArgs, (), {'a':1, 'b':2, 'c':3})
# Tests with extra arguments disallowed.
StandardTests(allowExtraArgs=False)
# These cases should emit an error because there are unexpected
# arguments
with self.assertRaises(TypeError):
Tf._ClassWithVarArgInit(False, 1, 2, 3, 4)
with self.assertRaises(TypeError):
Tf._ClassWithVarArgInit(False, d=4)
# This should emit an error because we have multiple values for a single
# arg.
with self.assertRaises(TypeError):
Tf._ClassWithVarArgInit(False, 1, 2, 3, b=4)
# Tests with extra arguments allowed.
StandardTests(allowExtraArgs=True)
CheckResults(Tf._ClassWithVarArgInit(True, 1, 2, 3, 4, 5),
True, (4,5), {'a':1, 'b':2, 'c':3})
CheckResults(Tf._ClassWithVarArgInit(True, 1, 2, c=3, d=6, f=8),
True, (), {'a':1, 'b':2, 'c':3, 'd':6, 'f':8})
CheckResults(Tf._ClassWithVarArgInit(True, 1, 2, 3, 4, d=8),
True, (4,), {'a':1, 'b':2, 'c':3, 'd':8})