code: def test_class_variables_for_namespace_warnings_work_correctly(self):
      # pylint: disable=protected-access
      assert "text" not in LabelField._already_warned_namespaces
      with self.assertLogs(
          logger="allennlp.data.fields.label_field", level="WARNING"
      ):
          _ = LabelField("test", label_namespace="text")
  
      # We've warned once, so we should have set the class variable to False.
      assert "text" in LabelField._already_warned_namespaces
      with pytest.raises(AssertionError):
          with self.assertLogs(
              logger="allennlp.data.fields.label_field", level="WARNING"
          ):
              _ = LabelField("test2", label_namespace="text")
  
      # ... but a new namespace should still log a warning.
      assert "text2" not in LabelField._already_warned_namespaces
      with self.assertLogs(
          logger="allennlp.data.fields.label_field", level="WARNING"
      ):
          _ = LabelField("test", label_namespace="text2")
  
file_path: magnitude/pymagnitude/third_party/allennlp/tests/data/fields/label_field_test.py
imports: from __future__ import with_statement
  from __future__ import absolute_import
  from __future__ import print_function
  import pytest
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.data.fields import LabelField
  from allennlp.data import Vocabulary
label_desc: Use image node_id 6 for calling the TestLabelField obj's underlying member method code with example usage: obj.test_class_variables_for_namespace_warnings_work_correctly() without return types