class_docstr: tests for caliban.platform.gke.util
class_docstr_tok: ["tests","for","caliban.platform.gke.util"]
docstr: tests trap decorator
code: def test_trap(self, return_val):
      """tests trap decorator"""
  
      def _raises():
          raise Exception("exception!")
  
      # make sure the test function works..testing the tester
      with self.assertRaises(Exception) as e:
          _raises()
  
      valid_return = "42"
  
      def _no_raise():
          return valid_return
  
      # ibid
      self.assertEqual(valid_return, _no_raise())
  
      print("testing return_val = {}".format(return_val))
  
      @trap(return_val)
      def _test_raises():
          _raises()
  
      @trap(return_val)
      def _test_no_raise():
          return _no_raise()
  
      # test for types where we can't test equality
      try:
          if return_val != return_val:
              return
      except:
          return
  
      if valid_return == return_val:
          return
  
      self.assertEqual(return_val, _test_raises())
      self.assertEqual(valid_return, _test_no_raise())
  
      return
  
imports: import random
  import unittest
  from typing import List, Optional, Dict
  from unittest import mock
  import uuid
  import json
  import os
  import tempfile
  import yaml
  import hypothesis.strategies
  from hypothesis import given, settings
  from kubernetes.client.api_client import ApiClient
  from kubernetes.client import V1Job
  import pytest
  import argparse
  import google
  import caliban.platform.cloud.types
  import caliban.platform.gke.constants
  import caliban.platform.gke.util
  from caliban.platform.gke.types import NodeImage, OpStatus
  from caliban.platform.gke.util import trap
label_desc: Use image node_id 5 for calling the UtilTestSuite obj's underlying member method code with example usage: obj.test_trap(return_val) and returns: valid_return, _no_raise