code: def test_fit_only_loc_scale(self):
      # fit only loc
      N = 5000
      rng = np.random.default_rng(self.seed)
  
      dist = stats.norm
      loc, scale = 1.5, 1
      data = dist.rvs(loc=loc, size=N, random_state=rng)
      loc_bounds = (0, 5)
      bounds = {"loc": loc_bounds}
      res = stats.fit(dist, data, bounds, optimizer=self.opt)
      assert_allclose(res.params, (loc, scale), **self.tols)
  
      # fit only scale
      loc, scale = 0, 2.5
      data = dist.rvs(scale=scale, size=N, random_state=rng)
      scale_bounds = (0.01, 5)
      bounds = {"scale": scale_bounds}
      res = stats.fit(dist, data, bounds, optimizer=self.opt)
      assert_allclose(res.params, (loc, scale), **self.tols)
  
      # fit only loc and scale
      dist = stats.norm
      loc, scale = 1.5, 2.5
      data = dist.rvs(loc=loc, scale=scale, size=N, random_state=rng)
      bounds = {"loc": loc_bounds, "scale": scale_bounds}
      res = stats.fit(dist, data, bounds, optimizer=self.opt)
      assert_allclose(res.params, (loc, scale), **self.tols)
  
imports: import os
  import numpy
  import numpy.testing
  from numpy.testing import assert_allclose, assert_equal
  import pytest
  from scipy import stats
  from scipy.optimize import differential_evolution
  from .test_continuous_basic import distcont
  from scipy.stats._distn_infrastructure import FitError
  from scipy.stats._distr_params import distdiscrete
  from scipy.stats import goodness_of_fit
label_desc: Use image node_id 15 for calling the TestFit obj's underlying member method code with example usage: obj.test_fit_only_loc_scale() without return types