<commit_before>import pytest
from django.core.urlresolvers import reverse

from example.tests.utils import load_json

pytestmark = pytest.mark.django_db


def test_included_data_on_list(multiple_entries, client):
    response = client.get(reverse("entry-list") + '?include=comments')
    included = load_json(response.content).get('included')

    assert len(load_json(response.content)['data']) == len(multiple_entries)
    assert [x.get('type') for x in included] == ['comments']
    assert (len([resource for resource in included if resource["type"] == "comments"]) ==
            sum([entry.comment_set.count() for entry in multiple_entries]))


def test_included_data_on_detail(single_entry, client):
    response = client.get(reverse("entry-detail", kwargs={'pk': single_entry.pk}) + '?include=comments')
    included = load_json(response.content).get('included')

    assert [x.get('type') for x in included] == ['comments']
    assert (len([resource for resource in included if resource["type"] == "comments"]) ==
            single_entry.comment_set.count())<commit_msg>Increased pagination for list test and added assert comments<commit_after>import pytest
from django.core.urlresolvers import reverse

from example.tests.utils import load_json

pytestmark = pytest.mark.django_db


def test_included_data_on_list(multiple_entries, client):
    response = client.get(reverse("entry-list") + '?include=comments&page_size=5')
    included = load_json(response.content).get('included')

    assert len(load_json(response.content)['data']) == len(multiple_entries), 'Correct entry count'
    assert [x.get('type') for x in included] == ['comments'], 'List included types are correct'

    comment_count = len([resource for resource in included if resource["type"] == "comments"])
    expected_comment_count = sum([entry.comment_set.count() for entry in multiple_entries])
    assert comment_count == expected_comment_count, 'List comment count is correct'


def test_included_data_on_detail(single_entry, client):
    response = client.get(reverse("entry-detail", kwargs={'pk': single_entry.pk}) + '?include=comments')
    included = load_json(response.content).get('included')

    assert [x.get('type') for x in included] == ['comments'], 'Detail included types are correct'
    comment_count = len([resource for resource in included if resource["type"] == "comments"])
    assert comment_count == single_entry.comment_set.count(), 'Detail comment count is correct'
{'fraction_non_alphanumeric': 0.13182369591589163, 'fraction_numerical': 0.0004043671653861706, 'mean_word_length': 5.544973544973545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6948782', 'n_tokens_mistral': 705, 'n_tokens_neox': 695, 'n_words': 178}