def testValueNodeWithBadParent(self): with self.assertRaisesRegexp( TypeError, 'parent_operation must be a OperationNode, got'): nodes.ValueNode('not an operation node', 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)
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)