def test_iter_elements(self): # /-- c2 # c1-| # \-- c3 --- c4 s = System() c1 = RigidConnection('c1') c2 = RigidConnection('c2') c3 = RigidConnection('c3') c4 = RigidConnection('c4') s.add_leaf(c1) c1.add_leaf(c2) c1.add_leaf(c3) c3.add_leaf(c4) s.setup() # Should iter elements depth-first self.assertEqual(list(s.iter_elements()), [c1, c2, c3, c4])