示例#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
示例#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
示例#3
0
 def test_build_subpart(self):
     with XMLBuilder("SUBPART") as ctx:
         ctx.HD(u"Subpart A—First subpart")
         with ctx.SECTION():
             ctx.SECTNO(u"§ 8675.309")
             ctx.SUBJECT("Definitions.")
             ctx.P("Some content about this section.")
             ctx.P("(a) something something")
         with ctx.SECTION():
             ctx.SECTNO(u"§ 8675.310")
             ctx.SUBJECT("Definitions.")
             ctx.P("Some content about this section.")
             ctx.P("(a) something something")
     subpart = reg_text.build_subpart('8675', ctx.xml)
     self.assertEqual(subpart.node_type, 'subpart')
     self.assertEqual(len(subpart.children), 2)
     self.assertEqual(subpart.label, ['8675', 'Subpart', 'A'])
     child_labels = [c.label for c in subpart.children]
     self.assertEqual([['8675', '309'], ['8675', '310']], child_labels)
 def test_build_subpart(self):
     with XMLBuilder("SUBPART") as ctx:
         ctx.HD(u"Subpart A—First subpart")
         with ctx.SECTION():
             ctx.SECTNO(u"§ 8675.309")
             ctx.SUBJECT("Definitions.")
             ctx.P("Some content about this section.")
             ctx.P("(a) something something")
         with ctx.SECTION():
             ctx.SECTNO(u"§ 8675.310")
             ctx.SUBJECT("Definitions.")
             ctx.P("Some content about this section.")
             ctx.P("(a) something something")
     subpart = reg_text.build_subpart('8675', ctx.xml)
     self.assertEqual(subpart.node_type, 'subpart')
     self.assertEqual(len(subpart.children), 2)
     self.assertEqual(subpart.label, ['8675', 'Subpart', 'A'])
     child_labels = [c.label for c in subpart.children]
     self.assertEqual([['8675', '309'], ['8675', '310']], child_labels)
示例#5
0
 def test_build_subpart(self):
     xml = u"""
         <SUBPART>
             <HD>Subpart A—First subpart</HD>
         <SECTION>
             <SECTNO>§ 8675.309</SECTNO>
             <SUBJECT>Definitions.</SUBJECT>
             <P>Some content about this section.</P>
             <P>(a) something something</P>
         </SECTION>
         <SECTION>
             <SECTNO>§ 8675.310 </SECTNO>
             <SUBJECT>Definitions.</SUBJECT>
             <P>Some content about this section.</P>
             <P>(a) something something</P>
         </SECTION>
         </SUBPART>
     """
     subpart = reg_text.build_subpart('8675', etree.fromstring(xml))
     self.assertEqual(subpart.node_type, 'subpart')
     self.assertEqual(len(subpart.children), 2)
     self.assertEqual(subpart.label, ['8675', 'Subpart', 'A'])
     child_labels = [c.label for c in subpart.children]
     self.assertEqual([['8675', '309'], ['8675', '310']], child_labels)
 def test_build_subpart(self):
     xml = u"""
         <SUBPART>
             <HD>Subpart A—First subpart</HD>
         <SECTION>
             <SECTNO>§ 8675.309</SECTNO>
             <SUBJECT>Definitions.</SUBJECT>
             <P>Some content about this section.</P>
             <P>(a) something something</P>
         </SECTION>
         <SECTION>
             <SECTNO>§ 8675.310 </SECTNO>
             <SUBJECT>Definitions.</SUBJECT>
             <P>Some content about this section.</P>
             <P>(a) something something</P>
         </SECTION>
         </SUBPART>
     """
     subpart = reg_text.build_subpart('8675', etree.fromstring(xml))
     self.assertEqual(subpart.node_type, 'subpart')
     self.assertEqual(len(subpart.children), 2)
     self.assertEqual(subpart.label, ['8675', 'Subpart', 'A'])
     child_labels = [c.label for c in subpart.children]
     self.assertEqual([['8675', '309'], ['8675', '310']], child_labels)