def test_as_dict(self):
        with XMLBuilder("ROOT") as ctx:
            ctx.PRTPAGE(P=44)
            ctx.AGENCY('Awesome Admin')
            ctx.SUBJECT('This is the title')

        notice = notice_xml.NoticeXML(ctx.xml)
        notice.cfr_refs = [
            notice_xml.TitlePartsRef(title=11, parts=[234, 456])
        ]
        notice.version_id = 'v1v1v1'
        notice.fr_volume = 33
        notice.fr_html_url = 'http://example.com'
        notice.published = date(2002, 2, 2)
        notice.comments_close_on = date(2003, 3, 3)
        notice.effective = date(2004, 4, 4)
        notice.rins = ['r1111', 'r2222']
        notice.docket_ids = ['d1111', 'd2222']
        notice.comment_doc_id = 'comment-docket'
        notice.primary_docket = 'd2222'
        notice.supporting_documents = [RegsGovDoc('some-id', 'A support doc')]

        self.assertEqual(
            notice.as_dict(), {
                'amendments': [],
                'comments_close':
                '2003-03-03',
                'comment_doc_id':
                'comment-docket',
                'cfr_parts': ['234', '456'],
                'cfr_title':
                11,
                'dockets': ['d1111', 'd2222'],
                'document_number':
                'v1v1v1',
                'effective_on':
                '2004-04-04',
                'fr_citation':
                '33 FR 43',
                'fr_url':
                'http://example.com',
                'fr_volume':
                33,
                'meta': {
                    'start_page': 43
                },
                'primary_agency':
                'Awesome Admin',
                'primary_docket':
                'd2222',
                'publication_date':
                '2002-02-02',
                'regulation_id_numbers': ['r1111', 'r2222'],
                'supporting_documents': [{
                    'regs_id': 'some-id',
                    'title': 'A support doc'
                }],
                'title':
                'This is the title'
            })
    def test_cfr_refs(self):
        """
        Test that we can set and retrieve the same values
        """
        def _reftest(refs):
            xml = self._dummy_notice()
            xml.cfr_refs = refs
            self.assertEqual(refs, xml.cfr_refs)

        _reftest([])
        _reftest([
            notice_xml.TitlePartsRef(title=40, parts=[300, 301, 302, 303]),
            notice_xml.TitlePartsRef(title=41, parts=[210]),
            notice_xml.TitlePartsRef(title=42, parts=[302, 303])
        ])
        _reftest([
            notice_xml.TitlePartsRef(title=40, parts=[300, 330]),
            notice_xml.TitlePartsRef(title=41, parts=[210]),
            notice_xml.TitlePartsRef(title=42, parts=[302, 303])
        ])
    if not depdoc:
        xml = _dummy_notice()
    else:
        with XMLBuilder("ROOT") as root:
            root.DEPDOC(depdoc)
        xml = notice_xml.NoticeXML(root.xml)

    dis = dis or xml.derive_docket_ids()
    xml.docket_ids = dis
    assert xml.docket_ids == expected


@pytest.mark.parametrize('refs', (
    [],
    [
        notice_xml.TitlePartsRef(title=40, parts=[300, 301, 302, 303]),
        notice_xml.TitlePartsRef(title=41, parts=[210]),
        notice_xml.TitlePartsRef(title=42, parts=[302, 303])
    ],
    [
        notice_xml.TitlePartsRef(title=40, parts=[300, 330]),
        notice_xml.TitlePartsRef(title=41, parts=[210]),
        notice_xml.TitlePartsRef(title=42, parts=[302, 303])
    ],
))
def test_cfr_refs(refs):
    """ Test that we can set and retrieve the same values """
    xml = _dummy_notice()
    xml.cfr_refs = refs
    assert refs == xml.cfr_refs