code: def test_qcut_allow_duplicates() -> None:
      s = pl.Series([1, 2, 2, 3])
  
      with pytest.raises(pl.DuplicateError):
          s.qcut([0.50, 0.51])
  
      result = s.qcut([0.50, 0.51], allow_duplicates=True)
  
      expected = pl.Series(
          ["(-inf, 2]", "(-inf, 2]", "(-inf, 2]", "(2, inf]"],
          dtype=pl.Categorical,
      )
      assert_series_equal(result, expected, categorical_as_str=True)
  
file_path: polars/py-polars/tests/unit/operations/test_qcut.py
imports: from __future__ import annotations
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 7 for calling a global function with example usage: test_qcut_allow_duplicates() without return types