code: def test_pick_contrasts_for_term():
      from patsy.desc import Term
  
      used = set()
      codings = pick_contrasts_for_term(Term([]), set(), used)
      assert codings == [{}]
      codings = pick_contrasts_for_term(
          Term(["a", "x"]), set(["x"]), used
      )
      assert codings == [{"a": False}]
      codings = pick_contrasts_for_term(Term(["a", "b"]), set(), used)
      assert codings == [{"a": True, "b": False}]
      used_snapshot = set(used)
      codings = pick_contrasts_for_term(Term(["c", "d"]), set(), used)
      assert codings == [{"d": False}, {"c": False, "d": True}]
      # Do it again backwards, to make sure we're deterministic with respect to
      # order:
      codings = pick_contrasts_for_term(
          Term(["d", "c"]), set(), used_snapshot
      )
      assert codings == [{"c": False}, {"c": True, "d": False}]
  
imports: from __future__ import print_function
  from patsy.util import no_pickling
label_desc: Use image node_id 9 for calling a global function with example usage: test_pick_contrasts_for_term() without return types