code: def test_request_with_non_native_objects(self):
      # We always send along json, but it may contain non-native objects like
      # a pandas array or a Column reference. Make sure that's handled in one
      # central place.
  
      class Duck(object):
          def to_plotly_json(self):
              return "what else floats?"
  
      utils.request(
          self.method, self.url, json={"foo": [Duck(), Duck()]}
      )
      args, kwargs = self.request_mock.call_args
      method, url = args
      expected_data = (
          '{"foo": ["what else floats?", "what else floats?"]}'
      )
      self.assertEqual(method, self.method)
      self.assertEqual(url, self.url)
      self.assertEqual(kwargs["data"], expected_data)
      self.assertNotIn("json", kwargs)
  
imports: from __future__ import absolute_import
  import json
  from requests.exceptions import ConnectionError
  from plotly import version
  from chart_studio.api.utils import to_native_utf8_string
  from chart_studio.api.v2 import utils
  from chart_studio.exceptions import PlotlyRequestError
  from chart_studio.session import sign_in
  from chart_studio.tests.test_plot_ly.test_api import PlotlyApiTestCase
label_desc: Use image node_id 3 for calling the RequestTest obj's underlying member method code with example usage: obj.test_request_with_non_native_objects() and returns: str