MCPcopy Create free account
hub / github.com/python/mypy / test_single_pair

Method test_single_pair

mypy/test/testinfer.py:350–366  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

348 )
349
350 def test_single_pair(self) -> None:
351 x0 = NameExpr("x0")
352 x1 = NameExpr("x1")
353
354 single_comparison = [("==", x0, x1)]
355 expected_output = [("==", [0, 1])]
356
357 assignable_combinations: list[dict[int, NameExpr]] = [{}, {0: x0}, {1: x1}, {0: x0, 1: x1}]
358 to_group_by: list[set[str]] = [set(), {"=="}, {"is"}]
359
360 for combo in assignable_combinations:
361 for operators in to_group_by:
362 keymap = self.literal_keymap(combo)
363 self.assertEqual(
364 group_comparison_operands(single_comparison, keymap, operators),
365 expected_output,
366 )
367
368 def test_empty_pair_list(self) -> None:
369 # This case should never occur in practice -- ComparisonExprs

Callers

nothing calls this directly

Calls 4

literal_keymapMethod · 0.95
NameExprClass · 0.90
setClass · 0.85

Tested by

no test coverage detected