def test_colo_coloctapp(self):
        """Ensures colo/coloctapp regex parses what we think it should."""
        tests = {
            "2016 COA 38. Nos. 14CA2454, 14CA2455, 14CA2456 & 14CA1457. People in the Interest of E.M.":
            {
                "docket": "14CA2454, 14CA2455, 14CA2456, 14CA1457",
                "name": "People in the Interest of E.M",
            },
            "2016 COA 32. No. 14CA1424. Brooks, Jr. v. Raemisch.": {
                "docket": "14CA1424",
                "name": "Brooks, Jr. v. Raemisch",
            },
            "2016 COA 33. Nos. 14CA1483 & 15CA0216. Rocky Mountain Exploration, Inc. v. Davis Graham & Stubbs LLP. ":
            {
                "docket":
                "14CA1483, 15CA0216",
                "name":
                "Rocky Mountain Exploration, Inc. v. Davis Graham & Stubbs LLP",
            },
            "2016 COA 79. 14CA2487. People v. Fransua.": {
                "docket": "14CA2487",
                "name": "People v. Fransua",
            },
            "2016 COA 51. No. 14CA2073.Campaign Integrity Watchdog v. Coloradans for a Better Future.":
            {
                "docket":
                "14CA2073",
                "name":
                "Campaign Integrity Watchdog v. Coloradans for a Better Future",
            },
            "2016 CO 43. No. 14SC1. Martinez v. Mintz.": {
                "docket": "14SC1",
                "name": "Martinez v. Mintz",
            },
            "No. 2016 COA 137. 15CA0620. Edwards v. Colorado Department of Revenue, Motor Vehicle Division. ":
            {
                "docket":
                "15CA0620",
                "name":
                "Edwards v. Colorado Department of Revenue, Motor Vehicle Division",
            }
            #'': {
            #    'docket': '',
            #    'name': '',
            # },
        }

        scraper = colo.Site()
        for raw_string, data in tests.items():
            for field in ["docket", "name"]:
                attribute = "_extract_%s_from_text" % field
                result = getattr(scraper, attribute)(raw_string)
                self.assertEqual(
                    data[field],
                    result,
                    msg=
                    "Did not get expected %s results when regex'ing: '%s'.\n  Expected: '%s'\n  Instead:  '%s'"
                    % (field, raw_string, data[field], result),
                )
Beispiel #2
0
    def test_colo_coloctapp(self):
        """Ensures colo/coloctapp regex parses what we think it should."""
        tests = {
            '2016 COA 38. Nos. 14CA2454, 14CA2455, 14CA2456 & 14CA1457. People in the Interest of E.M.':
            {
                'docket': '14CA2454, 14CA2455, 14CA2456, 14CA1457',
                'name': 'People in the Interest of E.M',
            },
            '2016 COA 32. No. 14CA1424. Brooks, Jr. v. Raemisch.': {
                'docket': '14CA1424',
                'name': 'Brooks, Jr. v. Raemisch',
            },
            '2016 COA 33. Nos. 14CA1483 & 15CA0216. Rocky Mountain Exploration, Inc. v. Davis Graham & Stubbs LLP. ':
            {
                'docket':
                '14CA1483, 15CA0216',
                'name':
                'Rocky Mountain Exploration, Inc. v. Davis Graham & Stubbs LLP',
            },
            '2016 COA 79. 14CA2487. People v. Fransua.': {
                'docket': '14CA2487',
                'name': 'People v. Fransua',
            },
            '2016 COA 51. No. 14CA2073.Campaign Integrity Watchdog v. Coloradans for a Better Future.':
            {
                'docket':
                '14CA2073',
                'name':
                'Campaign Integrity Watchdog v. Coloradans for a Better Future',
            },
            '2016 CO 43. No. 14SC1. Martinez v. Mintz.': {
                'docket': '14SC1',
                'name': 'Martinez v. Mintz',
            },
            'No. 2016 COA 137. 15CA0620. Edwards v. Colorado Department of Revenue, Motor Vehicle Division. ':
            {
                'docket':
                '15CA0620',
                'name':
                'Edwards v. Colorado Department of Revenue, Motor Vehicle Division',
            }
            #'': {
            #    'docket': '',
            #    'name': '',
            #},
        }

        scraper = colo.Site()
        for raw_string, data in tests.items():
            for field in ['docket', 'name']:
                attribute = '_extract_%s_from_text' % field
                result = getattr(scraper, attribute)(raw_string)
                self.assertEqual(
                    data[field],
                    result,
                    msg=
                    "Did not get expected %s results when regex'ing: '%s'.\n  Expected: '%s'\n  Instead:  '%s'"
                    % (field, raw_string, data[field], result))
Beispiel #3
0
 def test_colo(self):
     strings = (
         '2015 COA 101. No. 10CA2481. People v. DeGreat.',
         '2015 COA 102. No. 12CA1589. People v. Froehler.',
     )
     attrs = (
         'docket_numbers',
         'case_names',
         'neutral_citations'
     )
     site = colo.Site()
     for s in strings:
         for attr in attrs:
             try:
                 site.title_regex.search(s).group(attr)
             except AttributeError:
                 self.fail("Unable to parse string: '{s}'".format(s=s))