Exemplo n.º 1
0
def process_new_subpart(notice, subpart_added, par):
    """ A new subpart has been added, create the notice changes. """
    subpart_changes = {}
    subpart_xml = find_subpart(par)
    subpart = reg_text.build_subpart(notice['cfr_part'], subpart_xml)

    for change in changes.create_subpart_amendment(subpart):
        subpart_changes.update(change)
    return subpart_changes
Exemplo n.º 2
0
def process_new_subpart(notice, amd_label, par):
    """ A new subpart has been added, create the notice changes. """
    subpart_changes = {}
    subpart_xml = find_subpart(par)
    subpart = reg_text.build_subpart(amd_label.label[0], subpart_xml)

    for change in changes.create_subpart_amendment(subpart):
        subpart_changes.update(change)
    return subpart_changes
    def test_find_subpart(self):
        with self.tree.builder('REGTEXT', PART='105', TITLE='12') as regtext:
            regtext.AMDPAR("6. Add subpart B to read as follows:")
            with regtext.SUBPART() as subpart:
                subpart.HD(u"Subpart B—Requirements", SOURCE="HED")
                with subpart.SECTION() as section:
                    section.SECTNO("105.30")
                    section.SUBJECT("First In New Subpart")
                    section.P("For purposes of this subpart, the follow "
                              "apply:")
                    section.P('(a) "Agent" means agent.')

        notice_xml = self.tree.render_xml()
        amdpar_xml = notice_xml.xpath('//AMDPAR')[0]
        subpart = diff.find_subpart(amdpar_xml)
        self.assertTrue(subpart is not None)

        headings = [s for s in subpart if s.tag == 'HD']
        self.assertEqual(headings[0].text, u"Subpart B—Requirements")
    def test_find_subpart(self):
        xml = u"""
           <REGTEXT PART="105" TITLE="12">
            <AMDPAR>
                6. Add subpart B to read as follows:
            </AMDPAR>
            <SUBPART>
                <HD SOURCE="HED">Subpart B—Requirements</HD>
                <SECTION>
                    <SECTNO>105.30</SECTNO>
                    <SUBJECT>First In New Subpart</SUBJECT>
                    <P>For purposes of this subpart, the follow apply:</P>
                    <P>(a) "Agent" means agent.</P>
                </SECTION>
            </SUBPART>
           </REGTEXT>"""

        notice_xml = etree.fromstring(xml)
        amdpar_xml = notice_xml.xpath("//AMDPAR")[0]
        subpart = diff.find_subpart(amdpar_xml)
        self.assertTrue(subpart is not None)

        headings = [s for s in subpart if s.tag == "HD"]
        self.assertEqual(headings[0].text, u"Subpart B—Requirements")
Exemplo n.º 5
0
    def test_find_subpart(self):
        xml = u"""
           <REGTEXT PART="105" TITLE="12">
            <AMDPAR>
                6. Add subpart B to read as follows:
            </AMDPAR>
            <SUBPART>
                <HD SOURCE="HED">Subpart B—Requirements</HD>
                <SECTION>
                    <SECTNO>105.30</SECTNO>
                    <SUBJECT>First In New Subpart</SUBJECT>
                    <P>For purposes of this subpart, the follow apply:</P>
                    <P>(a) "Agent" means agent.</P>
                </SECTION>
            </SUBPART>
           </REGTEXT>"""

        notice_xml = etree.fromstring(xml)
        amdpar_xml = notice_xml.xpath('//AMDPAR')[0]
        subpart = diff.find_subpart(amdpar_xml)
        self.assertTrue(subpart is not None)

        headings = [s for s in subpart if s.tag == 'HD']
        self.assertEqual(headings[0].text, u"Subpart B—Requirements")