@pytest.mark.parametrize("with_ids", [True, False, None])
def test_changelog(db_request, with_ids):
    projects = [ProjectFactory.create() for _ in range(10)]
    entries = []
    for project in projects:
        for _ in range(10):
            entries.append(JournalEntryFactory.create(name=project.name))

    entries = sorted(entries, key=lambda x: x.id)

    since = int(
        entries[int(len(entries) / 2)].submitted_date
                                      .replace(tzinfo=datetime.timezone.utc)
                                      .timestamp()
    )

    expected = [
        (
            e.name,
            e.version,
            int(
                e.submitted_date
                 .replace(tzinfo=datetime.timezone.utc)
                 .timestamp()
            ),
            e.action,
            e.id,
        )
        for e in entries
        if (e.submitted_date.replace(
            tzinfo=datetime.timezone.utc).timestamp() > since)
    ]

    if not with_ids:
        expected = [e[:-1] for e in expected]

    extra_args = []
    if with_ids is not None:
        extra_args.append(with_ids)

    assert xmlrpc.changelog(db_request, 1 - since, *extra_args) == expected
dataset/ETHPy150Open pypa/warehouse/tests/unit/legacy/api/test_xmlrpc.py/test_changelog/swapped operands of `-`