code: def test_quantiles(self):
      d = fo.Dataset()
      d.add_sample_field("numeric_field", fo.IntField)
      self.assertIsNone(d.quantiles("numeric_field", 0.5))
      self.assertListEqual(d.quantiles("numeric_field", [0.5]), [None])
  
      s = fo.Sample(filepath="image.jpeg", numeric_field=1)
      d.add_sample(s)
      self.assertAlmostEqual(d.quantiles("numeric_field", 0.5), 1)
  
      s = fo.Sample(filepath="image2.jpeg", numeric_field=2)
      d.add_sample(s)
  
      q = np.linspace(0, 1, 11)
  
      results1 = d.quantiles("numeric_field", q)
  
      # only available in `numpy>=1.22`
      # results2 = np.quantile([1, 2], q, method="inverted_cdf")
      results2 = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2]
  
      self.assertEqual(len(results1), len(results2))
      for r1, r2 in zip(results1, results2):
          self.assertAlmostEqual(r1, r2)
  
      results1 = d.quantiles(2.0 * (F("numeric_field") + 1), q)
  
      # only available in `numpy>=1.22`
      # results2 = np.quantile([4, 6], q, method="inverted_cdf")
      results2 = [4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6]
  
      self.assertEqual(len(results1), len(results2))
      for r1, r2 in zip(results1, results2):
          self.assertAlmostEqual(r1, r2)
  
      with self.assertRaises(ValueError):
          d.quantiles("numeric_field", "bad-value")
  
      with self.assertRaises(ValueError):
          d.quantiles("numeric_field", -1)
  
      with self.assertRaises(ValueError):
          d.quantiles("numeric_field", 2)
  
imports: from datetime import date, datetime, timedelta
  import math
  from bson import ObjectId
  import numpy
  import unittest
  import fiftyone
  import fiftyone.core.fields
  from fiftyone import ViewField
  from decorators import drop_datasets
label_desc: Use image node_id 9 for calling the DatasetTests obj's underlying member method code with example usage: obj.test_quantiles() without return types