code: def test_referencetext(monkeypatch):
      monkeypatch.setenv("UPDATE_REF", "0")
      with tempfile.TemporaryDirectory(prefix="common-") as tempdir:
          with open(os.path.join(tempdir, "test.txt"), "w") as f:
              for i in range(3):
                  print(f"value {i}", file=f)
          r = ReferenceText(tempdir)
          r.assert_equal("test.txt", ["value 0", "value 1", "value 2"])
          with pytest.raises(AssertionError):
              r.assert_equal("test.json", ["value 0"])
          with pytest.raises(AssertionError):
              r.assert_equal("fake.json", ["stuff"])
          r.assert_equal(
              "test.json", ["value 0", "value 1"], update_ref=True
          )
          with open(os.path.join(tempdir, "test.json")) as f:
              assert f.read() == "value 0\nvalue 1\n"
  
          # Test single string input
          r.assert_equal("test.json", "value 0\nvalue 1")
          r.assert_equal(
              "test.json", "value 0\nvalue 2", update_ref=True
          )
          with open(os.path.join(tempdir, "test.json")) as f:
              assert f.read() == "value 0\nvalue 2\n"
  
file_path: modelkit/tests/test_testing.py
imports: import datetime
  import decimal
  import json
  import os
  import tempfile
  import pytest
  from modelkit.testing.reference import ReferenceJson, ReferenceText, deep_format_floats
label_desc: Use image node_id 2 for calling a global function with example usage: test_referencetext(monkeypatch) without return types