<commit_before>from django.http import HttpRequest
from django.test.client import Client
from pytest_django.client import RequestFactory
import pytest

pytest_plugins = ['pytester']


def test_client(client):
    assert isinstance(client, Client)


def test_admin_client(admin_client):
    assert isinstance(admin_client, Client)
    assert admin_client.get('/admin-required/').content == 'You are an admin'


def test_rf(rf):
    assert isinstance(rf, RequestFactory)
    try:
        rf.request()
    except:
        pytest.fail(msg='Plain call to funcarg rf.request() throws error.')
    request = RequestFactory().get('/path/')
    assert isinstance(request, HttpRequest)
    assert request.path == '/path/'
    assert request.method == 'GET'
    request = RequestFactory().post('/submit/', {'foo': 'bar'})
    assert isinstance(request, HttpRequest)
    assert request.path == '/submit/'
    assert request.method == 'POST'
    assert request.POST['foo'] == 'bar'


# These tests should really be done with a testdir, but setting up the Django
# environment within the temporary tests is a right pain
def test_settings(settings):
    assert settings.DEFAULT_FROM_EMAIL != '<EMAIL>', settings.DEFAULT_FROM_EMAIL
    settings.DEFAULT_FROM_EMAIL = '<EMAIL>'
    assert settings.DEFAULT_FROM_EMAIL == '<EMAIL>'
    from django.conf import settings as real_settings
    assert real_settings.DEFAULT_FROM_EMAIL == '<EMAIL>'
<commit_msg>Improved consistency in test_funcargs.test_rf.<commit_after>from django.http import HttpRequest
from django.test.client import Client
from pytest_django.client import RequestFactory
import pytest

pytest_plugins = ['pytester']


def test_client(client):
    assert isinstance(client, Client)


def test_admin_client(admin_client):
    assert isinstance(admin_client, Client)
    assert admin_client.get('/admin-required/').content == 'You are an admin'


def test_rf(rf):
    assert isinstance(rf, RequestFactory)
    try:
        rf.request()
    except:
        pytest.fail(msg='Plain call to funcarg rf.request() throws error.')
    request = rf.get('/path/')
    assert isinstance(request, HttpRequest)
    assert request.path == '/path/'
    assert request.method == 'GET'
    request = rf.post('/submit/', {'foo': 'bar'})
    assert isinstance(request, HttpRequest)
    assert request.path == '/submit/'
    assert request.method == 'POST'
    assert request.POST['foo'] == 'bar'


# These tests should really be done with a testdir, but setting up the Django
# environment within the temporary tests is a right pain
def test_settings(settings):
    assert settings.DEFAULT_FROM_EMAIL != '<EMAIL>', settings.DEFAULT_FROM_EMAIL
    settings.DEFAULT_FROM_EMAIL = '<EMAIL>'
    assert settings.DEFAULT_FROM_EMAIL == '<EMAIL>'
    from django.conf import settings as real_settings
    assert real_settings.DEFAULT_FROM_EMAIL == '<EMAIL>'

{'fraction_non_alphanumeric': 0.11130434782608696, 'fraction_numerical': 0.0, 'mean_word_length': 4.248175182481752, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '624477', 'n_tokens_mistral': 825, 'n_tokens_neox': 821, 'n_words': 237}