code: def setup_method(self):
      super().setup_method()
      self._broadcast_view_used = False
      # use broadcast view for direct API
      real_direct_view = (
          self.client.real_direct_view
      ) = self.client.direct_view
  
      def broadcast_or_direct(targets):
          if isinstance(targets, int):
              return real_direct_view(targets)
          else:
              self._broadcast_view_used = True
              return self.client.broadcast_view(
                  targets, is_coalescing=self.is_coalescing
              )
  
      self.client.direct_view = broadcast_or_direct
  
file_path: ipyparallel/ipyparallel/tests/test_view_broadcast.py
imports: import pytest
  from .None import test_view
label_desc: Use image node_id 1 for calling the TestBroadcastView obj's underlying member method code with example usage: obj.setup_method() and returns: real_direct_view, self