<commit_before>import pytest
import datetime as dt
from pupa.scrape import Event as ScrapeEvent
from pupa.importers import EventImporter
from opencivicdata.models import Event, Jurisdiction


def ge():
    event = ScrapeEvent(
        name="America's Birthday",
        start_time="2014-07-04T05:00Z",
        location="America",
        timezone="America/New_York",
        all_day=True)
    event.add_person("<NAME>")
    return event


@pytest.mark.django_db
def test_related_people_event():
    j = Jurisdiction.objects.create(id='jid', division_id='did')
    event1 = ge()
    event2 = ge()

    for event in [event1, event2]:
        item = event.add_agenda_item("Cookies will be served")
        item.add_person(person="<NAME>")

    result = EventImporter('jid').import_data([event1.as_dict()])
    assert result['event']['insert'] == 1

    result = EventImporter('jid').import_data([event2.as_dict()])
    assert result['event']['noop'] == 1


@pytest.mark.django_db
def test_related_bill_event():
    j = Jurisdiction.objects.create(id='jid', division_id='did')
    event1 = ge()
    event2 = ge()

    for event in [event1, event2]:
        item = event.add_agenda_item("Cookies will be served")
        item.add_bill(bill="HB 101")<commit_msg>add test for related votes to events<commit_after>import pytest
import datetime as dt
from pupa.scrape import Event as ScrapeEvent
from pupa.importers import EventImporter
from opencivicdata.models import Event, Jurisdiction


def ge():
    event = ScrapeEvent(
        name="America's Birthday",
        start_time="2014-07-04T05:00Z",
        location="America",
        timezone="America/New_York",
        all_day=True)
    event.add_person("<NAME>")
    return event


@pytest.mark.django_db
def test_related_people_event():
    j = Jurisdiction.objects.create(id='jid', division_id='did')
    event1 = ge()
    event2 = ge()

    for event in [event1, event2]:
        item = event.add_agenda_item("Cookies will be served")
        item.add_person(person="<NAME>")

    result = EventImporter('jid').import_data([event1.as_dict()])
    assert result['event']['insert'] == 1

    result = EventImporter('jid').import_data([event2.as_dict()])
    assert result['event']['noop'] == 1
    

@pytest.mark.django_db
def test_related_vote_event():
    j = Jurisdiction.objects.create(id='jid', division_id='did')
    event1 = ge()
    event2 = ge()

    for event in [event1, event2]:
        item = event.add_agenda_item("Cookies will be served")
        item.add_vote(vote="Roll no. 12")

    result = EventImporter('jid').import_data([event1.as_dict()])
    assert result['event']['insert'] == 1

    result = EventImporter('jid').import_data([event2.as_dict()])
    assert result['event']['noop'] == 1


@pytest.mark.django_db
def test_related_bill_event():
    j = Jurisdiction.objects.create(id='jid', division_id='did')
    event1 = ge()
    event2 = ge()

    for event in [event1, event2]:
        item = event.add_agenda_item("Cookies will be served")
        item.add_bill(bill="HB 101")
{'fraction_non_alphanumeric': 0.13986243039633148, 'fraction_numerical': 0.020962987225679658, 'mean_word_length': 3.7422360248447206, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7476617', 'n_tokens_mistral': 1064, 'n_tokens_neox': 994, 'n_words': 212}