code: def test_validate_constraints():
      with patch(
          gen_requirements,
          REQUIREMENTS_BY_PIECE=TEST_REQUIREMENTS_BY_PIECE,
          CONSTRAINTS=(
              ("unlisted", "~=3"),
              ("double-specified", "<2"),
              (
                  "double-specified",
                  "==3",
              ),
              ("bad-constraint", "1.2.0"),
              ("bad-semver-constraint", "i don't match the regex :P"),
              ("alpha-semver-constraint", "^foo.bar.23"),
          ),
      ):
          problems = gen_requirements.validate_constraints()
          assert problems == [
              "unlisted: not specified in REQUIREMENTS_BY_PIECE",
              "double-specified: not specified in REQUIREMENTS_BY_PIECE",
              "double-specified: specified twice",
              "double-specified: not specified in REQUIREMENTS_BY_PIECE",
              "bad-constraint: not specified in REQUIREMENTS_BY_PIECE",
              'bad-constraint: constraint "1.2.0" does not look like a valid constraint',
              "bad-semver-constraint: not specified in REQUIREMENTS_BY_PIECE",
              'bad-semver-constraint: constraint "i don\'t match the regex :P" does not look like a valid constraint',
              "alpha-semver-constraint: not specified in REQUIREMENTS_BY_PIECE",
              "alpha-semver-constraint: invalid semver constraint ^foo.bar.23",
              "CONSTRAINTS entries should be in this sorted order: ['alpha-semver-constraint', 'bad-constraint', 'bad-semver-constraint', 'double-specified', 'double-specified', 'unlisted']",
          ]
  
file_path: tvm/tests/python/testing/test_gen_requirements.py
imports: import collections
  import contextlib
  import os
  import sys
  import tvm
  import tvm.testing
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_validate_constraints() without return types