def test_get_results_two_dates_same_revision_id(self):
        """check that PerfTable handles 2 dates in the data correctly"""

        # generate a second block of performance history data
        # with the same length as the first block
        new_date = float(self.lines[0].split(None, 2)[1]) + 1
        new_line = '%s %s %s' % (
            self.lines[0].split(None, 2)[0],
            new_date,
            self.lines[0].split(None, 2)[2],
        )
        lines = [new_line] + self.lines[1:] + self.lines

        perftable = PerfTable(lines)
        results = list(perftable.get_results())
        assert len(results) == 2 * self.num_test_ids

        # get results for one (test_id, revision_id) pair
        # and check that get_result returns a result object for each date
        test_ids = perftable.list_values_of('test_id')[:1]
        revision_ids = perftable.list_values_of('revision_id')[:1]
        results = list(
            perftable.get_results(test_ids=test_ids,
                                  revision_ids=revision_ids))
        assert len(results) == 1 + 1
        r0 = results[0]
        r1 = results[1]
        assert r0 != r1
        #check that r0 and r1 are equal, except the date is different
        r0.date = r1.date = None
        assert r0.test_id == r1.test_id
Example #2
0
    def test_get_results_two_dates_same_revision_id(self):
        """check that PerfTable handles 2 dates in the data correctly"""

        # generate a second block of performance history data
        # with the same length as the first block
        new_date = float(self.lines[0].split(None, 2)[1]) + 1
        new_line = '%s %s %s' % (
            self.lines[0].split(None, 2)[0],
            new_date,
            self.lines[0].split(None, 2)[2],
        )
        lines = [new_line] + self.lines[1:] + self.lines

        perftable = PerfTable(lines)
        results = list(perftable.get_results())
        assert len(results) == 2* self.num_test_ids

        # get results for one (test_id, revision_id) pair
        # and check that get_result returns a result object for each date
        test_ids = perftable.list_values_of('test_id')[:1]
        revision_ids = perftable.list_values_of('revision_id')[:1]
        results = list(perftable.get_results(test_ids = test_ids,
                                             revision_ids = revision_ids))
        assert len(results) == 1+1
        r0 = results[0]
        r1 = results[1]
        assert r0 != r1
        #check that r0 and r1 are equal, except the date is different
        r0.date = r1.date = None
        assert r0.test_id == r1.test_id
    def test_get_results(self):
        """check that get_results returns the right number of PerfResults"""

        perftable = PerfTable()
        perftable.add_lines(self.lines)
        results = list(perftable.get_results())
        assert len(results) == self.num_test_ids
        test_ids = perftable.list_values_of('test_id')
        # check that get_result returns all results for an empty test_id argument
        assert list(perftable.get_results()) == (list(
            perftable.get_results(test_ids=test_ids)))
        # check that get_results returns only the requested (number of) results
        results = list(perftable.get_results(test_ids=test_ids[1:]))
        assert len(results) == self.num_test_ids - 1
Example #4
0
    def test_get_results(self):
        """check that get_results returns the right number of PerfResults"""

        perftable = PerfTable()
        perftable.add_lines(self.lines)
        results = list(perftable.get_results())
        assert len(results) == self.num_test_ids
        test_ids = perftable.list_values_of('test_id')
        # check that get_result returns all results for an empty test_id argument
        assert list(perftable.get_results()) == (
                          list(perftable.get_results(test_ids = test_ids)))
        # check that get_results returns only the requested (number of) results
        results = list(perftable.get_results(test_ids = test_ids[1:]))
        assert len(results) == self.num_test_ids -1