def testAttrValueToPyObject(self, pbtxt, expected): proto = attr_value_pb2.AttrValue() text_format.Parse(pbtxt, proto) result = _op_def_util.SerializedAttrValueToPyObject( proto.SerializeToString()) self.assertEqual(expected, result)
def testAttrValueToPyObjectError(self, pbtxt): proto = attr_value_pb2.AttrValue() text_format.Parse(pbtxt, proto) with self.assertRaises((TypeError, ValueError)): _op_def_util.SerializedAttrValueToPyObject(proto.SerializeToString())