code: def test_binary_operations():
      OP_MAP = {
          "+": operator.add,
          "-": operator.sub,
          "*": operator.mul,
          "/": operator.truediv,
          "%": operator.mod,
          "===": operator.eq,
          "<": operator.lt,
          "<=": operator.le,
          ">": operator.gt,
          ">=": operator.ge,
          "!==": operator.ne,
          "&&": operator.and_,
          "||": operator.or_,
      }
      # When these are on the RHS, the opposite is evaluated instead.
      INEQ_REVERSE = {
          ">": "<",
          "<": ">",
          "<=": ">=",
          ">=": "<=",
          "===": "===",
          "!==": "!==",
      }
      for op, func in OP_MAP.items():
          z1 = func(datum.xxx, 2)
          assert repr(z1) == "(datum.xxx {} 2)".format(op)
  
          z2 = func(2, datum.xxx)
          if op in INEQ_REVERSE:
              assert repr(z2) == "(datum.xxx {} 2)".format(
                  INEQ_REVERSE[op]
              )
          else:
              assert repr(z2) == "(2 {} datum.xxx)".format(op)
  
          z3 = func(datum.xxx, datum.yyy)
          assert repr(z3) == "(datum.xxx {} datum.yyy)".format(op)
  
file_path: altair/tests/expr/test_expr.py
imports: import operator
  import pytest
  from altair import expr
  from altair import datum
  from altair import ExprRef
  from jsonschema.exceptions import ValidationError
label_desc: Use image node_id 2 for calling a global function with example usage: test_binary_operations() without return types