def test_multiple_batches_bootstrap(self):
        """Test using a repository that has lots of builds, esp. PRs."""
        _travis = _get_travispy()
        repo = get_travis_repo(_travis, 'twbs/bootstrap')

        builds = get_historical_builds(_travis, repo,
                                       _after=12071,
                                       _load_jobs=False)

        ids = []
        prev_number = None
        for build in builds:
            assert build.repository_id == 12962

            if int(build.number) in [12069, 12062, 12061, 12054, 12049,
                                     12048, 12041, 12038, 12037, 12033]:
                # Many duplicates
                # See https://github.com/travis-ci/travis-ci/issues/2582
                print('duplicate build number {0}: {1}'.format(
                    build.number, build.id))

                if build.id in [53437234, 53350534, 53350026,
                                53263731, 53263730,  # two extra 12054
                                53180440, 53179846, 53062896, 53019568,
                                53004896, 52960766]:
                    assert prev_number == int(build.number)
                else:
                    assert prev_number == int(build.number) + 1

            elif prev_number:
                # All other build numbers decrease rather orderly
                assert prev_number == int(build.number) + 1

            prev_number = int(build.number)

            if ids:
                assert build.id < ids[-1]

            ids.append(build.id)
            # There are many more duplicates, so we stop here.
            if int(build.number) == 12033:
                break

        assert len(ids) == len(set(ids))