pandera icon indicating copy to clipboard operation
pandera copied to clipboard

`values` arg in `unique_values_eq` has incorrect type hint.

Open devmcp opened this issue 2 years ago • 1 comments

Describe the bug In unique_values_eq the docstring says that values is an iterable, but the argument has the typehint str.

There is also a typo in the docstring - should read "May be any iterable."

  • [x] I have checked that this issue has not already been reported.
  • [x] I have confirmed this bug exists on the latest version of pandera.
  • [ ] (optional) I have confirmed this bug exists on the master branch of pandera.

devmcp avatar Feb 12 '24 12:02 devmcp

This issue still exists in version 0.24.0. When a list of strings is passed, the check works as expected, but it causes failures in a mypy hook (and potentially with other type checkers). Example error message:

"unique_values_eq" of "Check" has incompatible type "list[str]"; expected "str" [arg-type] ... pa.Column(dtype=str, checks=pa.Check.unique_values_eq(["mock_str1", "mock_str2"]))},

AhmetZamanis avatar May 29 '25 10:05 AhmetZamanis