class_docstr: Tests for the anomalyzer.
class_docstr_tok: ["Tests","for","the","anomalyzer","."]
code: def testAddSingle(self):
      expectedOutput = (
          "Timestamp,Value\n"
          "datetime,int\n"
          "T,\n"
          "2011-09-04 02:00:00.000000,1\n"
          "2011-09-04 02:05:00.000000,10\n"
          "2011-09-04 02:10:00.000000,3\n"
          "2011-09-04 02:15:00.000000,4\n"
          "2011-09-04 02:20:00.000000,5\n"
          "2011-09-04 02:25:00.000000,6\n"
      )
      mockInput = MagicMock(return_value=StringIO(self.sampleInput))
      output = StringIO()
      mockOutput = MagicMock(return_value=output)
      with patch("__builtin__.open", mockInput):
          inputFile = FileRecordStream("input_path")
          with patch("__builtin__.open", mockOutput):
              outputFile = FileRecordStream(
                  "output_path",
                  fields=inputFile.getFields(),
                  write=True,
              )
              anomalyzer.add(inputFile, outputFile, 1, 1, 1, 8)
      result = output.getvalue()
      result = result.replace("\r\n", "\n")
      result = result.replace("\r", "\n")
      self.assertSequenceEqual(expectedOutput, result)
  
file_path: nupic-legacy/tests/unit/nupic/data/generators/anomalyzer_test.py
imports: import csv
  from mock import MagicMock, patch
  from StringIO import StringIO
  import unittest2
  from nupic.data.file_record_stream import FileRecordStream
  from nupic.data.generators import anomalyzer
label_desc: Use image node_id 5 for calling the AnomalyzerTest obj's underlying member method code with example usage: obj.testAddSingle() without return types