{"record":{"id":"d4abde0b7e060fff","repo":"pola-rs/polars","slug":"null-probability-should-be-between-0-0-and-1-0","errorCode":null,"errorMessage":"`null_probability` should be between 0.0 and 1.0, got {prob!r}","messagePattern":"`null_probability` should be between 0\\.0 and 1\\.0, got (.+?)","errorType":"validation","errorClass":"InvalidArgument","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/testing/parametric/strategies/core.py","lineNumber":610,"sourceCode":"    def __post_init__(self) -> None:\n        if self.null_probability is not None:\n            self.allow_null = _handle_null_probability_deprecation(  # type: ignore[assignment]\n                self.null_probability\n            )\n\n\ndef _handle_null_probability_deprecation(\n    null_probability: float | Mapping[str, float],\n) -> bool | dict[str, bool]:\n    issue_deprecation_warning(\n        \"`null_probability` is deprecated. Use `allow_null` instead.\",\n        version=\"0.20.26\",\n    )\n\n    def prob_to_bool(prob: float) -> bool:\n        if not (0.0 <= prob <= 1.0):\n            msg = f\"`null_probability` should be between 0.0 and 1.0, got {prob!r}\"\n            raise InvalidArgument(msg)\n\n        return bool(prob)\n\n    if isinstance(null_probability, Mapping):\n        return {col: prob_to_bool(prob) for col, prob in null_probability.items()}\n    else:\n        return prob_to_bool(null_probability)\n","sourceCodeStart":592,"sourceCodeEnd":618,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/py-polars/src/polars/testing/parametric/strategies/core.py#L592-L618","documentation":"Validation inside the deprecated null_probability handling of the hypothesis testing strategies: each probability (global or per-column) must lie in [0.0, 1.0] since it is converted to an allow_null boolean. Any out-of-range float triggers this InvalidArgument. Prefer the newer allow_null parameter.","triggerScenarios":"Thrown at py-polars/src/polars/testing/parametric/strategies/core.py:610 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a probability in the range [0.0, 1.0] for `null_probability`."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}