code: def test_error_when_local_version_label_is_used_incorrectly(
      self, operator: str
  ) -> None:
      # GIVEN
      to_parse = f"name {operator} 1.0+local.version.label"
      op_tilde = len(operator) * "~"
  
      # WHEN
      with pytest.raises(InvalidRequirement) as ctx:
          Requirement(to_parse)
  
      # THEN
      assert ctx.exconly() == (
          "packaging.requirements.InvalidRequirement: "
          "Local version label can only be used with `==` or `!=` operators\n"
          f"    name {operator} 1.0+local.version.label\n"
          f"         {op_tilde}~~~~^"
      )
  
imports: from typing import Optional, Set
  import pytest
  from packaging.markers import Marker
  from packaging.requirements import InvalidRequirement, Requirement
  from packaging.specifiers import SpecifierSet
label_desc: Use image node_id 11 for calling the TestRequirementParsing obj's underlying member method code with example usage: obj.test_error_when_local_version_label_is_used_incorrectly(operator) without return types