darienmorrow: First things that comes to mind is to try to fit two variables which are anticorrelated with eachother. Or to fit a single variable which does not change the output of the function.
diff --git a/WrightTools/kit/_leastsq.py b/WrightTools/kit/_leastsq.py
index 1c93935..d448ba3 100644
--- a/WrightTools/kit/_leastsq.py
+++ b/WrightTools/kit/_leastsq.py
@@ -65,7 +65,7 @@ def leastsqfitter(p0, datax, datay, function, verbose=False, cov_verbose=False):
             if cov_verbose:
                 print(pcov)
         else:
-            pcov = np.inf
+            pcov = np.array(np.inf)
         # calculate and write errors
         error = []
         for i in range(len(pfit_leastsq)):

pcov TypeError in kit._leastsq
In kit._leastsq, if the line 62 if statement is not passed, the consequent else statement makes pcov data type float, triggering"TypeError: 'int' object is not subscriptable" in line 72-73:

72:      try:
73:                error.append(np.absolute(pcov[i][i]) ** 0.5)

Line 74 picks up index out of bound errors, not sure if it was meant to catch the type error.

74:      except IndexError:
75:                 error.append(0.00)

Error is bypassed if I put a 2D array into line 68, but have not spent the time considering what this array should look like.
diff --git a/tests/kit/leastsqfitter.py b/tests/kit/leastsqfitter.py
new file mode 100644
index 0000000..184eaba
--- /dev/null
+++ b/tests/kit/leastsqfitter.py
@@ -0,0 +1,19 @@
+import numpy as np
+import WrightTools as wt
+
+
+def test_leastsq():
+    x = np.linspace(0, 10)
+    y = np.linspace(10, 0)
+    fit, cov = wt.kit.leastsqfitter([0, 0], x, y, lambda p, x: p[0] * x + p[1])
+    assert np.allclose(fit, [-1, 10])
+    assert np.allclose(cov, [0, 0])
+
+
+def test_leastsq_no_corr():
+    x = np.linspace(0, 10)
+    y = np.linspace(10, 0)
+    # The third parameter does not determine output, this caused an exception in wt <= 3.2.1
+    fit, cov = wt.kit.leastsqfitter([0, 0, 0], x, y, lambda p, x: p[0] * x + p[1])
+    assert np.allclose(fit, [-1, 10, 0])
+    assert np.allclose(cov, [0, 0, 0])

pip install -e .[dev]
parse_log_pytest
pytest
pytest pytest-cov flake8 pydocstyle pytest
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
black==25.1.0
cfgv==3.4.0
click==8.1.8
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
distlib==0.3.9
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
filelock==3.18.0
flake8==7.2.0
fonttools==4.56.0
h5py==3.13.0
identify==2.6.9
imageio==2.37.0
importlib_resources==6.5.2
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
kiwisolver==1.4.7
matplotlib==3.9.4
mccabe==0.7.0
mypy-extensions==1.0.0
nodeenv==1.9.1
numexpr==2.10.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pathspec==0.12.1
pillow==11.1.0
platformdirs==4.3.7
pluggy @ file:///croot/pluggy_1733169602837/work
pre_commit==4.2.0
pycodestyle==2.13.0
pydocstyle==6.3.0
pyflakes==3.3.1
pyparsing==3.2.3
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
scipy==1.13.1
six==1.17.0
snowballstemmer==2.2.0
tidy_headers==1.0.4
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions==4.13.0
virtualenv==20.29.3
-e git+https://github.com/wright-group/WrightTools.git@d57d9b26b5040bf0e78ce2353b3d5081b41a1608#egg=WrightTools
zipp==3.21.0

name: WrightTools
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - black==25.1.0
      - cfgv==3.4.0
      - click==8.1.8
      - contourpy==1.3.0
      - coverage==7.8.0
      - cycler==0.12.1
      - distlib==0.3.9
      - filelock==3.18.0
      - flake8==7.2.0
      - fonttools==4.56.0
      - h5py==3.13.0
      - identify==2.6.9
      - imageio==2.37.0
      - importlib-resources==6.5.2
      - kiwisolver==1.4.7
      - matplotlib==3.9.4
      - mccabe==0.7.0
      - mypy-extensions==1.0.0
      - nodeenv==1.9.1
      - numexpr==2.10.2
      - numpy==2.0.2
      - pathspec==0.12.1
      - pillow==11.1.0
      - platformdirs==4.3.7
      - pre-commit==4.2.0
      - pycodestyle==2.13.0
      - pydocstyle==6.3.0
      - pyflakes==3.3.1
      - pyparsing==3.2.3
      - pytest-cov==6.0.0
      - python-dateutil==2.9.0.post0
      - pyyaml==6.0.2
      - scipy==1.13.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - tidy-headers==1.0.4
      - typing-extensions==4.13.0
      - virtualenv==20.29.3
      - zipp==3.21.0
prefix: /opt/conda/envs/WrightTools

tests/kit/leastsqfitter.py::test_leastsq_no_corr
tests/kit/leastsqfitter.py::test_leastsq
WrightTools/kit/_leastsq.py
WrightTools/kit/_leastsq.py