<commit_before># -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
import pytest

from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings

from readthedocs.projects.models import Project
from readthedocs.builds.constants import LATEST
from readthedocs.core.templatetags import core_tags


@override_settings(USE_SUBDOMAIN=False, PRODUCTION_DOMAIN='readthedocs.org')
class CoreTagsTests(TestCase):
    fixtures = ["eric", "test_data"]

    def setUp(self):
        url_base = '{scheme}://{domain}/docs/pip{{ version }}'.format(
            scheme=pytest.config.option.url_scheme,
            domain=settings.PRODUCTION_DOMAIN,
        )

        self.pip_latest_url = url_base.format(version='/en/latest/')
        self.pip_latest_fr_url = url_base.format(version='/fr/latest/')
        self.pip_abc_url = url_base.format(version='/en/abc/')
        self.pip_abc_fr_url = url_base.format(version='/fr/abc/')
        self.pip_abc_xyz_page_url = url_base.format(version='/en/abc/xyz.html')
        self.pip_abc_xyz_fr_page_url = url_base.format(version='/fr/abc/xyz.html')
        self.pip_abc_xyz_dir_url = url_base.format(version='/en/abc/xyz/')
        self.pip_abc_xyz_fr_dir_url = url_base.format(version='/fr/abc/xyz/')
        self.pip_abc_xyz_document = url_base.format(version='/en/abc/index.html#document-xyz')
        self.pip_abc_xyz_fr_document = url_base.format(version='/fr/abc/index.html#document-xyz')
        self.pip_latest_document_url = url_base.format(version='/en/latest/document/')
        self.pip_latest_document_page_url = url_base.format(version='/en/latest/document.html')

        with mock.patch('readthedocs.projects.models.broadcast'):
            self.client.login(username='eric', password='<PASSWORD>')
            self.pip = Project.objects.get(slug='pip')
            self.pip_fr = Project.objects.create(name="PIP-FR", slug='pip-fr', language='fr', main_language_project=self.pip)

    def test_project_only(self):
        proj = Project.objects.get(slug='pip')
        url = core_tags.make_document_url(proj)<commit_msg>Minor fix to URL base<commit_after># -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
import pytest

from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings

from readthedocs.projects.models import Project
from readthedocs.builds.constants import LATEST
from readthedocs.core.templatetags import core_tags


@override_settings(USE_SUBDOMAIN=False, PRODUCTION_DOMAIN='readthedocs.org')
class CoreTagsTests(TestCase):
    fixtures = ["eric", "test_data"]

    def setUp(self):
        url_base = '{scheme}://{domain}/docs/pip{{version}}'.format(
            scheme=pytest.config.option.url_scheme,
            domain=settings.PRODUCTION_DOMAIN,
        )

        self.pip_latest_url = url_base.format(version='/en/latest/')
        self.pip_latest_fr_url = url_base.format(version='/fr/latest/')
        self.pip_abc_url = url_base.format(version='/en/abc/')
        self.pip_abc_fr_url = url_base.format(version='/fr/abc/')
        self.pip_abc_xyz_page_url = url_base.format(version='/en/abc/xyz.html')
        self.pip_abc_xyz_fr_page_url = url_base.format(version='/fr/abc/xyz.html')
        self.pip_abc_xyz_dir_url = url_base.format(version='/en/abc/xyz/')
        self.pip_abc_xyz_fr_dir_url = url_base.format(version='/fr/abc/xyz/')
        self.pip_abc_xyz_document = url_base.format(version='/en/abc/index.html#document-xyz')
        self.pip_abc_xyz_fr_document = url_base.format(version='/fr/abc/index.html#document-xyz')
        self.pip_latest_document_url = url_base.format(version='/en/latest/document/')
        self.pip_latest_document_page_url = url_base.format(version='/en/latest/document.html')

        with mock.patch('readthedocs.projects.models.broadcast'):
            self.client.login(username='eric', password='<PASSWORD>')
            self.pip = Project.objects.get(slug='pip')
            self.pip_fr = Project.objects.create(name="PIP-FR", slug='pip-fr', language='fr', main_language_project=self.pip)

    def test_project_only(self):
        proj = Project.objects.get(slug='pip')
        url = core_tags.make_document_url(proj)
{'fraction_non_alphanumeric': 0.13264829518916393, 'fraction_numerical': 0.00046707146193367583, 'mean_word_length': 3.8505096262740657, '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': '4660467', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1422, 'n_words': 183}