Exemplo n.º 1
0
    def end_state(self):

        seen_attribute_keys = {}
        entity_dcts = []

        import modality_agnostic.test_support.common as em
        listener, _emissions = em.listener_and_emissions_for(self, limit=None)

        _ = _subject_module().open_traversal_stream(
            listener=listener,
            html_document_path=html_fixture('0130-tag-subtree.html'))

        with _ as dcts:
            for dct in dcts:
                for k in dct.keys():
                    seen_attribute_keys[k] = None
                entity_dcts.append(dct)

        # (we can't assine lvars to lvalues of the same name in a class)
        seen_attribute_keys_ = tuple(sorted(seen_attribute_keys.keys()))

        class State:  # #class-as-namespace
            seen_attribute_keys = seen_attribute_keys_
            business_objects = tuple(entity_dcts)
            emissions = tuple(_emissions)

        return State
    def end_state(self):
        import modality_agnostic.test_support.common as em
        use_listener, emissions = em.listener_and_emissions_for(
            self, limit=None)  # noqa: E501

        sections = []

        def store_previous_initially():
            state.store_previous = store_previous_normally

        class state:  # #class-as-namespace
            store_previous = store_previous_initially

        def store_previous_normally():
            sections.append(section)

        class _Section:
            def __init__(self, s):
                self.item_strings = []
                self.header_content = s

        _cm = _subject_module().open_traversal_stream(
            listener=use_listener,
            html_document_path=html_fixture('0120-real-subtree.html'))
        with _cm as dcts:
            for dct in dcts:
                if 'header_level' in dct:
                    state.store_previous()
                    section = _Section(dct['header_content'])
                else:
                    section.item_strings.append(dct['text'])

        store_previous_normally()

        class _State:
            def __init__(self, em_tup, sect_tup):
                self.emissions = em_tup
                self.sections = sect_tup

        return _State(tuple(emissions), tuple(sections))
Exemplo n.º 3
0
 def cached_document_path(self):
     return html_fixture('0170-hugo-docs.html')
Exemplo n.º 4
0
 def end_state(self):
     return build_state_the_bernstein_way(
         fixture_document_path=html_fixture('0140-bernstein-subtree.html'),
         producer_module=_subject_module())
 def cached_document_path(self):
     return html_fixture('0160-heroku-add-ons.html')
 def cached_document_path(self):
     return html_fixture('0180-hugo-themes.html')