Skip to content

PY-TEST0017 · broad_example_property_candidate_count

Count broad literal example families that should state one generated property.

This is a deterministic rule for python. Read its implementation.

Find sibling tests with the same syntax after literals are replaced by typed slots. Require at least minimum_cases distinct literal vectors. A large homogeneous example family is evidence that the suite is enumerating a domain around one invariant, which Hypothesis can generate and shrink more directly. The default boundary is ten examples.

Each finding reports the exact example count and literal-neutral test shape. The value is the number of broad example families. PY-TEST0003 owns shorter families that should use ordinary Pytest parametrization.

Repeated vectors, different control flow, fixtures, call targets, marks, or literal types form different groups or abstain. Keep explicit examples when every case has distinct domain meaning, marks, or identifiers. A property test must state an invariant rather than merely generating the old examples.

Bad

Ten sibling `test_round_trip_*` tests differ only in one integer input, so the value is `1`.
Good

Three named test_protocol_* scenarios state distinct behavior, so the value remains 0.

  • Cites “Hypothesis documentation”, when to use property-based testing. Open reference
  • Cites “pytest documentation”, parametrization. Open reference