class_docstr: Unit test for Google Test's JSON output functionality.
class_docstr_tok: ["Unit","test","for","Google","Test","'s","JSON","output","functionality","."]
docstr: Checks whether the timestamp attribute in the JSON output is valid.
  
  Runs a test program that generates an empty JSON output, and checks if
  the timestamp attribute in the testsuites tag is valid.
docstr_tok: ["Checks","whether","the","timestamp","attribute","in","the","JSON","output","is","valid",".","Runs","a","test","program","that","generates","an","empty","JSON","output",",","and","checks","if","the","timestamp","attribute","in","the","testsuites","tag","is","valid","."]
code: def testTimestampValue(self):
      """Checks whether the timestamp attribute in the JSON output is valid.
  
      Runs a test program that generates an empty JSON output, and checks if
      the timestamp attribute in the testsuites tag is valid.
      """
      actual = self._GetJsonOutput("gtest_no_test_unittest", [], 0)
      date_time_str = actual["timestamp"]
      # datetime.strptime() is only available in Python 2.5+ so we have to
      # parse the expected datetime manually.
      match = re.match(
          r"(\d+)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)", date_time_str
      )
      self.assertTrue(
          re.match,
          "JSON datettime string %s has incorrect format"
          % date_time_str,
      )
      date_time_from_json = datetime.datetime(
          year=int(match.group(1)),
          month=int(match.group(2)),
          day=int(match.group(3)),
          hour=int(match.group(4)),
          minute=int(match.group(5)),
          second=int(match.group(6)),
      )
  
      time_delta = abs(datetime.datetime.now() - date_time_from_json)
      # timestamp value should be near the current local time
      self.assertTrue(
          time_delta < datetime.timedelta(seconds=600),
          "time_delta is %s" % time_delta,
      )
  
file_path: open-asset-importer/contrib/googletest/googletest/test/googletest-json-output-unittest.py
imports: import datetime
  import errno
  import json
  import os
  import re
  import sys
  from googletest.test import gtest_json_test_utils
  from googletest.test import gtest_test_utils
label_desc: Use image node_id 2 for calling the GTestJsonOutputUnitTest obj's underlying member method code with example usage: obj.testTimestampValue() without return types