Example #1
0
        def it_returns_a_collecting_child_before_itself():
            group = BaseGroup()
            group.add_child(BaseGroup())

            group.is_collecting = True
            group.children[0].is_collecting = True

            assert group.get_collecting_group() == group.children[0]
Example #2
0
        def it_returns_rightmost_collecting_child():
            group = BaseGroup()
            group.add_child(BaseGroup())
            group.add_child(BaseGroup())

            group.children[0].is_collecting = True
            group.children[1].is_collecting = True

            assert group.get_collecting_group() == group.children[1]
Example #3
0
 def it_adds_a_group_to_its_children_and_sets_parent():
     group_a = BaseGroup()
     group_b = BaseGroup()
     group_a.add_child(group_b)
     assert group_a.children == [group_b]
     assert group_b.parent == group_a
Example #4
0
 def it_returns_own_group_if_it_is_collecting_and_has_no_children():
     group = BaseGroup()
     group.is_collecting = True
     assert group.get_collecting_group() == group