<commit_before>import pytest
from django.utils.translation import ugettext as _

from adhocracy4.ratings.models import Rating
from adhocracy4.exports.views import ItemExportView
from adhocracy4.exports.mixins import ItemExportWithRatesMixin
from adhocracy4.exports.mixins import ItemExportWithCommentCountMixin
from adhocracy4.exports.mixins import ItemExportWithCommentsMixin
from adhocracy4.exports.mixins import ItemExportWithLocationMixin
from tests.apps.ideas.models import Idea


@pytest.mark.django_db
def test_item_export(idea_factory, module, rf):
    request_ = rf.get('/')
    module_ = module

    class IdeaExportView(ItemExportView):
        model = Idea<commit_msg>add tests for SimpleItemExportView<commit_after>import pytest
from django.utils.translation import ugettext as _

from adhocracy4.exports.views import ItemExportView
from adhocracy4.exports.views import SimpleItemExportView

from tests.apps.ideas.models import Idea


def test_simple_item_export_without_setup_fields():

    class SimpleExportView(SimpleItemExportView):
        pass

    with pytest.raises(NotImplementedError):
        SimpleExportView()


def test_simple_item_export_without_export_rows():

    class SimpleExportView(SimpleItemExportView):

        def _setup_fields(self):
            return [], []

    view = SimpleExportView()

    with pytest.raises(NotImplementedError):
        view.export_rows()


def test_simple_item_export_filename():

    class SimpleExportView(SimpleItemExportView):

        def _setup_fields(self):
            return [], []

        def export_rows(self):
            return []

    view = SimpleExportView()

    assert view.get_base_filename().startswith('download')


@pytest.mark.django_db
def test_item_export(idea_factory, module, rf):
    request_ = rf.get('/')
    module_ = module

    class IdeaExportView(ItemExportView):
        model = Idea
{'fraction_non_alphanumeric': 0.07313195548489666, 'fraction_numerical': 0.0042395336512983575, 'mean_word_length': 4.363636363636363, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3378082', 'n_tokens_mistral': 571, 'n_tokens_neox': 549, 'n_words': 116}