def show(self): """ This is where we go output the content of a block and any valid child block that it contains. """ # Start by finalising the block. # Any active content is added to self.options if self.content: self.options.append(self.content) output = Composite() for index, option in enumerate(self.options): if index in self.valid_blocks: # A block may be valid but has a command that causes this to be # disregarded. if self.is_valid_by_command(index) is False: continue # add the content of the block and any children # to the output for item in option: if isinstance(item, Block): output.append(item.show()) else: output.append(item) break # Build up our output. self.process_composite_chunk_item(output.get_content()) return output
def test_Composite_iadd_4(): c = Composite("moo") c += Composite("moo") result = c.get_content() assert result == [{"full_text": "moo"}, {"full_text": "moo"}]
def test_Composite_append_4(): c = Composite("moo") c.append(Composite("moo")) result = c.get_content() assert result == [{"full_text": "moo"}, {"full_text": "moo"}]
def test_Composite_iadd_4(): c = Composite('moo') c += (Composite('moo')) result = c.get_content() assert result == [{'full_text': 'moo'}, {'full_text': 'moo'}]
def test_Composite_append_3(): c = Composite('moo') c.append([{'full_text': 'moo'}]) result = c.get_content() assert result == [{'full_text': 'moo'}, {'full_text': 'moo'}]