Skip to content

Commit

Permalink
fix: type errors, apoiu
Browse files Browse the repository at this point in the history
  • Loading branch information
dogweather committed Jul 23, 2023
1 parent b409d5e commit aba74f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions tests/public_law/parsers/usa/crs_articles_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_correct_number_of_articles_in_a_division_2(self):

def test_article_number_1(self):
code_of_crim_pro = cast(Division, PARSED_TITLE_16.children[0])
article_1 = code_of_crim_pro.children[0]
article_1 = cast(Article, code_of_crim_pro.children[0])

assert article_1.number == "1"

Expand All @@ -68,7 +68,7 @@ def test_article_name_1(self):

def test_division_name_1(self):
div_1_code_of_crim_pro = cast(Division, PARSED_TITLE_16.children[0])
article_1 = div_1_code_of_crim_pro.children[0]
article_1 = cast(Article, div_1_code_of_crim_pro.children[0])

assert article_1.division_name == "Code of Criminal Procedure"

Expand Down
29 changes: 16 additions & 13 deletions tests/public_law/parsers/usa/crs_divisions_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pytest
from typing import cast

from scrapy.http.response.xml import XmlResponse

from public_law.test_util import *
from public_law.parsers.usa.colorado.crs import parse_title_bang
from public_law.items.crs import Division


# Divisions aren't parsing correctly.
Expand All @@ -22,6 +24,19 @@
TITLE_07 = XmlResponse(body = fixture('usa', 'crs', "title07.xml"), url = "title07.xml", encoding = "utf-8")
PARSED_TITLE_07 = parse_title_bang(TITLE_07, null_logger)



class TestParseErrors:
def test_name(self):
divs = PARSED_TITLE_1.children
assert divs[0].name == "General, Primary, Recall, and Congressional Vacancy Elections"

def test_title_number(self):
divs = PARSED_TITLE_1.children
assert divs[0].title_number == "1"


class TestParseTitle7:
# $ grep '<T-DIV>' tmp/sources/CRSDADA20220915/TITLES/title07.xml
#
# <T-DIV>CORPORATIONS</T-DIV>
Expand All @@ -39,26 +54,14 @@
# <T-DIV>Colorado Business Corporations</T-DIV>
# <T-DIV>Nonprofit Corporations</T-DIV>


class TestParseErrors:
def test_name(self):
divs = PARSED_TITLE_1.children
assert divs[0].name == "General, Primary, Recall, and Congressional Vacancy Elections"

def test_title_number(self):
divs = PARSED_TITLE_1.children
assert divs[0].title_number == "1"


class TestParseTitle7:
def test_correct_number_of_divisions(self):
assert len(PARSED_TITLE_07.children) == 8
for putative_division in PARSED_TITLE_07.children:
assert putative_division.kind == "Division"

@pytest.mark.skip
def test_correct_number_of_subdivisions(self):
first_division = PARSED_TITLE_07.children[0]
first_division = cast(Division, PARSED_TITLE_07.children[0])

assert len(first_division.children) == 4
for item in first_division.children:
Expand Down

0 comments on commit aba74f9

Please sign in to comment.