<commit_before>"""
    tests.test_packages
    ~~~~~~~~~~~~~~~~~~~~~
    Test packages API.

    :copyright: (c) 2019 <NAME>.
    :license: AGPL, see LICENSE for more details.
"""
import requests


def test_api_packages_list(latex_on_http_api_url):
    """
    The API list available/installed Texlive/tlgmr packages.
    """
    r = requests.get("{}/packages".format(latex_on_http_api_url), allow_redirects=False)
    assert r.status_code == 200
    payload = r.json()
    assert "packages" in payload
    packages = payload["packages"]
    assert isinstance(packages, list) is True
    for package in packages:
        assert "name" in package
        assert "shortdesc" in package
        assert "url_info" in package
        assert "url_ctan" in package
        assert "installed" in package
        assert package["installed"] is True
    assert len(packages) == 3898


PACKAGE_INFO_MANDATORIES_PROPERTIES = [
    "package",
    "cat-date",
    "cat-license",
    "cat-topics",
    "cat-version",
    "category",
    "collection",
    "installed",
    "longdesc",
    "relocatable",
    "revision",
    "shortdesc",
    "sizes",
    "url_ctan",<commit_msg>Update package number<commit_after>"""
    tests.test_packages
    ~~~~~~~~~~~~~~~~~~~~~
    Test packages API.

    :copyright: (c) 2019 <NAME>.
    :license: AGPL, see LICENSE for more details.
"""
import requests


def test_api_packages_list(latex_on_http_api_url):
    """
    The API list available/installed Texlive/tlgmr packages.
    """
    r = requests.get("{}/packages".format(latex_on_http_api_url), allow_redirects=False)
    assert r.status_code == 200
    payload = r.json()
    assert "packages" in payload
    packages = payload["packages"]
    assert isinstance(packages, list) is True
    for package in packages:
        assert "name" in package
        assert "shortdesc" in package
        assert "url_info" in package
        assert "url_ctan" in package
        assert "installed" in package
        assert package["installed"] is True
    assert len(packages) == 3905


PACKAGE_INFO_MANDATORIES_PROPERTIES = [
    "package",
    "cat-date",
    "cat-license",
    "cat-topics",
    "cat-version",
    "category",
    "collection",
    "installed",
    "longdesc",
    "relocatable",
    "revision",
    "shortdesc",
    "sizes",
    "url_ctan",
{'fraction_non_alphanumeric': 0.1313304721030043, 'fraction_numerical': 0.00944206008583691, 'mean_word_length': 2.9982847341337906, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1036241', 'n_tokens_mistral': 751, 'n_tokens_neox': 714, 'n_words': 183}