def test_enumerating_single_widget(self):
        """
        If there is only a single widget in hierarchy, it should be returned
        """
        label = QLabel()

        assert_that(satin.all_widgets(label),
                    contains_inanyorder(label))
    def test_enumerating_layout_with_widget(self):
        """
        If there is layout containing a widget, the widget should be returned
        """
        layout = QHBoxLayout()
        label = QLabel()

        layout.addWidget(label)

        assert_that(satin.all_widgets(layout),
                    contains_inanyorder(label))
    def test_layout_inside_layout(self):
        """
        Layout inside of layout should be treated like just a layout
        """
        outer_layout = QHBoxLayout()
        inner_layout = QHBoxLayout()
        label = QLabel()

        inner_layout.addWidget(label)
        outer_layout.addLayout(inner_layout)

        assert_that(satin.all_widgets(outer_layout),
                    contains_inanyorder(label))
    def test_mixed_layouts_and_widgets(self):
        """
        Mixing layouts and widgets at different levels
        """
        outer_layout = QHBoxLayout()
        inner_layout = QHBoxLayout()
        label_1 = QLabel('one')
        label_2 = QLabel('two')

        inner_layout.addWidget(label_1)
        outer_layout.addLayout(inner_layout)
        outer_layout.addWidget(label_2)

        assert_that(satin.all_widgets(outer_layout),
                    contains_inanyorder(label_1, label_2))