Esempio n. 1
0
    def test_rule_history(self):
        with fixture("division_450.html") as f:
            html = Selector(text=f.read())
            expected = "OBDD 2-2011, f. & cert. ef. 1-3-11"
            first_history = parse_division(html)[0]["history"]

            assert first_history == expected
Esempio n. 2
0
    def test_rule_authority(self):
        with fixture("division_450.html") as f:
            html = Selector(text=f.read())
            expected = ["ORS 359"]
            first_authority = parse_division(html)[0]["authority"]

            assert first_authority == expected
Esempio n. 3
0
    def test_rule_implements(self):
        with fixture("division_450.html") as f:
            html = Selector(text=f.read())
            expected = ["ORS 359"]
            first_implements = parse_division(html)[0]["implements"]

            assert first_implements == expected
Esempio n. 4
0
    def test_rule_text(self):
        with fixture("division_450.html") as f:
            html = Selector(text=f.read())
            expected_text = "<p>(1) “Commission” means the Oregon Arts Commission.</p>\n<p>(2) “Executive Director” means the administrator of the Arts Program of the Oregon Business Development Department.</p>"
            first_text = parse_division(html)[0]["text"]

            assert first_text == expected_text
Esempio n. 5
0
    def test_rule_names(self):
        with fixture("division_450.html") as f:
            html = Selector(text=f.read())
            names = [n["name"] for n in parse_division(html)]

            assert names == ["Definitions", "Grants"]
Esempio n. 6
0
 def test_rule_numbers(self):
     with fixture("division_450.html") as f:
         html = Selector(text=f.read())
         numbers = [n["number"] for n in parse_division(html)]
         assert numbers == ["123-450-0000", "123-450-0010"]
Esempio n. 7
0
 def test_number_of_rules(self):
     with fixture("division_450.html") as f:
         html = Selector(text=f.read())
         assert len(parse_division(html)) == 2
Esempio n. 8
0
    def parse_division_page(self, response: Response):
        chapter: Chapter = self.oar["chapters"][response.meta["chapter_index"]]
        division: Division = chapter["divisions"][
            response.meta["division_index"]]

        division["rules"].extend(parse_division(response))