class_docstr: Provide test coverage when using provided estimators for optimal number of
  bins
class_docstr_tok: ["Provide","test","coverage","when","using","provided","estimators","for","optimal","number","of","bins"]
docstr: Straightforward testing with a mixture of linspace data (for
  consistency). Adding in a 3rd mixture that will then be
  completely ignored. All test values have been precomputed and
  the shouldn't change.
docstr_tok: ["Straightforward","testing","with","a","mixture","of","linspace","data","(","for","consistency",")",".","Adding","in","a","3rd","mixture","that","will","then","be","completely","ignored",".","All","test","values","have","been","precomputed","and","the","should","n't","change","."]
code: def test_simple_range(self):
      """
      Straightforward testing with a mixture of linspace data (for
      consistency). Adding in a 3rd mixture that will then be
      completely ignored. All test values have been precomputed and
      the shouldn't change.
      """
      # some basic sanity checking, with some fixed data.
      # Checking for the correct number of bins
      basic_test = {
          50: {
              "fd": 8,
              "scott": 8,
              "rice": 15,
              "sturges": 14,
              "auto": 14,
              "stone": 8,
          },
          500: {
              "fd": 15,
              "scott": 16,
              "rice": 32,
              "sturges": 20,
              "auto": 20,
              "stone": 80,
          },
          5000: {
              "fd": 33,
              "scott": 33,
              "rice": 69,
              "sturges": 27,
              "auto": 33,
              "stone": 80,
          },
      }
  
      for testlen, expectedResults in basic_test.items():
          # create some sort of non uniform data to test with
          # (3 peak uniform mixture)
          x1 = np.linspace(-10, -1, testlen // 5 * 2)
          x2 = np.linspace(1, 10, testlen // 5 * 3)
          x3 = np.linspace(-100, -50, testlen)
          x = np.hstack((x1, x2, x3))
          for estimator, numbins in expectedResults.items():
              a, b = np.histogram(x, estimator, range=(-20, 20))
              msg = f"For the {estimator} estimator"
              msg += f" with datasize of {testlen}"
              assert_equal(len(a), numbins, err_msg=msg)
  
imports: import functools
  from unittest import expectedFailure, skipIf
  from pytest import raises
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, slowTest, TEST_WITH_TORCHDYNAMO, TestCase, xpassIfTorchDynamo
label_desc: Use image node_id 9 for calling the TestHistogramOptimBinNums obj's underlying member method code with example usage: obj.test_simple_range() without return types