typing icon indicating copy to clipboard operation
typing copied to clipboard

typeddicts - update conformance tests according to the spec

Open Andrej730 opened this issue 9 months ago • 0 comments

Added missing tests to typeddicts_operations.py based on the current state of https://typing.python.org/en/latest/spec/typeddict.html#supported-and-unsupported-operations

Stumbled upon type checkers having a different behaviour for typed_dict[str], investigated the spec and the spec is clear about type checkers generally rejecting operations with arbitrary strings - so wanted to reflect the spec in conformance tests.

Added tests for:

  1. Disallowed popitem.
  2. Not requires keys - spec allows both behaviours.
  3. Extra keys in get and with in - spec is not certain about this, so I guess it allows both behaviours.
  4. Operations with variable keys - disallowed descructive and non-destructive operations except .get and in.

Added baseline output commit just for a reference - to confirm that there no other typecheckers version changes at play in the updated output. I can remove it before merge to avoid additional diffs.

Andrej730 avatar Apr 19 '25 08:04 Andrej730