Beispiel #1
0
def test_annotate_footnotes_m_15_17(m_15_17_doc):
    # Page numbers and footnotes can clash; handle page numbers first.
    pagenumbers.annotate_page_numbers(m_15_17_doc)
    notes = tuplify(footnotes.annotate_footnotes(m_15_17_doc))
    # Run this to check that there isn't a clash over lists:
    lists.annotate_lists(m_15_17_doc)

    expected = [
        (1, 'See U.S. Department of Education, National Center for '
         'Education Statistics. Public High School Graduation Rates. '
         'https://nces.ed.gov/programs/coe/indicator coi.asp.'),
        (2, 'See U.S. Department of Education, National Center for '
         'Education Statistics. Public High School Four-Year On-Time '
         'Graduation Rates and Event Dropout Rates: School Years '
         '2010-11 and 2011-12, by Marie C. Stetser and Robert '
         '\nStillwell, NCES 2014-39 (2014). '
         'http://nces.ed.gov/pubs2014/201439l.pdf.'),
        (3, 'U.S. Department of Health and Human Services, Administration for '
         'Substance Abuse and Mental Health Services. Administrator Pamela '
         'Hyde, "Behavioral Health and Tribal Communities." Presentation '
         'at the National Indian \nEducation Association\'s 141h Annual '
         'Legislative Summit, Washington, D.C., February 8, 2011. '
         '\nhttp://www.store.samhsa.gov/shin/content/SMA ll-PHYDE020811 '
         '/SMA ll-PHYDE0208ll.pdf.'),
        (4, 'U.S. Department of Health and Human Services, Administration '
         'for Substance Abuse and Mental Health Services. Spero M. '
         'Manson, "Culturally Appropriate Strategies for Prevention-Based '
         'Work in Tribal Communities." Presentation \n'
         'for the Enhancing State Prevention Systems for Children & Youth: '
         'National Webinar Series, August 21 , 2013 . \n'
         'http://www.nasmhpd.org/docs/Webinars%20ppts/'
         'Culturally%20Appreopriate Tribal%20webinar%2008.21.20 13 .pdf.'),
        (5, "U.S. Department of Education, Office of Special Education "
         "Programs, My Brother 's Keeper Task Force Report to the "
         "President (20 14). "
         "http://www. whitehouse.gov/sites/default/files/docs/053014 mbk "
         "report. pdf."),
        (6, 'U.S. Department of Health and Human Services, Center for '
         'Behavioral Health Statistics and Quality, National Survey on '
         'Drug Use and Health, ICPSR 34933 (2012). '
         'http://doi.org/10.3886/ICPSR34933.v2.'),
        (7, '"[F]ederal promotion of tribal self-government under formal '
         'policies known as \'self-determination\' is turning out to be, '
         'after a century or more of failed efforts to improve the lives '
         'ofthe U.S. indigenous people, the only strategy that has \n'
         'worked." Stephen Cornell and Joseph P. Kalt, American Indian '
         'Self-Determination: The Political Economy ofa Policy \nthat '
         'Works. Working Paper No. RWPI0-043, at 15. Harvard Kennedy '
         'School of Government, 2010. \n'
         'http:/ /nrs.harvard.edu/um-3: HUL.InstRepos:4553 307.')
    ]

    for i, note in enumerate(expected):
        assert note == notes[i]
Beispiel #2
0
def test_annotate_footnotes_m_17_11_0(m_17_11_0_doc):
    # Page numbers and footnotes can clash; handle page numbers first.
    pagenumbers.annotate_page_numbers(m_17_11_0_doc)
    notes = tuplify(footnotes.annotate_footnotes(m_17_11_0_doc))
    citations = tuplify(footnotes.annotate_citations(m_17_11_0_doc))
    # Run this to check that there isn't a clash over lists:
    lists.annotate_lists(m_17_11_0_doc)

    # We're testing this footnote specifically because the source line for this
    # footnote citation contains text that's slightly smaller than most of the
    # text in the document, which was previously throwing off detection of this
    # footnote citation.
    assert notes[5] == (6, 'Id. at§ 5(a).')

    assert citations[5] == (6, 'living adjustment. "')
Beispiel #3
0
def test_annotate_lists_works(m_16_19_doc):
    lists = annotate_lists(m_16_19_doc)

    assert str(lists[1][1][0]).startswith('1. Transitioning to')

    assert lists[1][1][0].annotation == OMBListItem(list_id=1,
                                                    number=1,
                                                    is_ordered=True,
                                                    indentation=1)
    assert lists[1][1][0][0].annotation == OMBListItemMarker(is_ordered=True)

    assert str(lists[1][2][0]).startswith('2. Migrating to inter-agency')

    assert lists[1][2][0].annotation == OMBListItem(list_id=1,
                                                    number=2,
                                                    is_ordered=True,
                                                    indentation=1)

    assert str(lists[2][1][0]).startswith('• Coordinating with OMB')

    assert lists[2][1][0].annotation == OMBListItem(list_id=2,
                                                    number=1,
                                                    is_ordered=False,
                                                    indentation=1)
    assert lists[2][1][0][0].annotation == OMBListItemMarker(is_ordered=False)

    assert str(lists[5][1][0]).startswith('a. A description of any')

    assert lists[5][1][0].annotation == OMBListItem(
        list_id=5,
        number=1,
        is_ordered=True,
        indentation=2,
    )
Beispiel #4
0
def test_lists_are_annotated_on_m_15_17(m_15_17_doc):
    lists = annotate_lists(m_15_17_doc)
    titles = [
        'Improve Educational Outcomes and Life Outcomes for Native Youth',
        'Increase Access to Quality Teacher Housing',
        'Improve Access to the Internet',
        'Support the Implementation ofthe Indian Child Welfare Act',
        'Reduce Teen Suicide',
    ]

    for i in range(1, 6):
        assert lists[1][i][0].annotation == OMBListItem(list_id=1,
                                                        number=i,
                                                        is_ordered=False,
                                                        indentation=1)

        assert titles[i - 1] in ' '.join(str(line) for line in lists[1][i])