示例#1
0
 def testValueNodeWithBadParent(self):
     with self.assertRaisesRegexp(
             TypeError, 'parent_operation must be a OperationNode, got'):
         nodes.ValueNode('not an operation node', 0)
示例#2
0
 def testValueNodeWithNegativeValueIndex(self):
     a = nodes.apply_operation(_Constant, value='a', label='Constant[a]')
     with self.assertRaisesWithLiteralMatch(
             ValueError,
             'value_index was -1 but parent_operation had 1 outputs'):
         nodes.ValueNode(a.parent_operation, -1)
示例#3
0
 def testValueNodeWithTooHighValueIndex(self):
     parent = nodes.OperationNode(_Constant('a'), ())
     with self.assertRaisesWithLiteralMatch(
             ValueError,
             'value_index was 2 but parent_operation had 1 outputs'):
         nodes.ValueNode(parent, 2)