def testFetchAroundRev(self): test_key = self._AddSampleData() rows = debug_alert._FetchRowsAroundRev(test_key, 310, 5, 8) revisions = [r.revision for r in rows] self.assertEqual( [305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317], revisions)
def testRevisionList(self): test_key = self._AddSampleData() rows = debug_alert._FetchRowsAroundRev(test_key.get(), 310, 5, 5) # The lookup dict maps indexes to x-values in the input series. self.assertEqual( [306, 307, 308, 309, 310, 311, 312, 313, 314, 315], debug_alert._RevisionList(rows))
def testFetchAroundRev(self): test_key = self._AddSampleData() rows = debug_alert._FetchRowsAroundRev(test_key.get(), 310, 5, 8) revisions = [r.revision for r in rows] self.assertEqual( [306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318], revisions)
def testRevisionList(self): test_key = self._AddSampleData() rows = debug_alert._FetchRowsAroundRev(test_key.get(), 310, 5, 5) # The lookup dict maps indexes to x-values in the input series. self.assertEqual( [306, 307, 308, 309, 310, 311, 312, 313, 314, 315], debug_alert._RevisionList(rows))
def testChartSeries(self): test_key = self._AddSampleData() rows = debug_alert._FetchRowsAroundRev(test_key, 310, 5, 5) # The indexes used in the chart series should match those in the lookup. self.assertEqual([(0, 60.65), (1, 55.61), (2, 61.88), (3, 61.51), (4, 59.58), (5, 71.79), (6, 71.97), (7, 71.63), (8, 67.16), (9, 70.91)], debug_alert._ChartSeries(rows))
def testChartSeries(self): test_key = self._AddSampleData() rows = debug_alert._FetchRowsAroundRev(test_key.get(), 310, 5, 5) # The indexes used in the chart series should match those in the lookup. self.assertEqual( [(0, 55.61), (1, 61.88), (2, 61.51), (3, 59.58), (4, 71.79), (5, 71.97), (6, 71.63), (7, 67.16), (8, 70.91), (9, 73.4)], debug_alert._ChartSeries(rows))
def testFetchRowsAroundRev_NotAllRowsAvailable(self): test_key = self._AddSampleData() rows = debug_alert._FetchRowsAroundRev(test_key, 310, 100, 100) # There are only 20 rows in the sample data, so only 20 can be fetched. self.assertEqual(20, len(rows))
def testFetchRowsAroundRev_NotAllRowsAvailable(self): test_key = self._AddSampleData() rows = debug_alert._FetchRowsAroundRev(test_key.get(), 310, 100, 100) # There are only 20 rows in the sample data, so only 20 can be fetched. self.assertEqual(20, len(rows))