def test_id_with_parent_having_setup_and_teardown(self): tc = TestCase() assert_equal(tc.setup.config(name='S').id, 't1-k1') assert_equal(tc.teardown.config(name='T').id, 't1-k2') tc.body = [BodyItem(), BodyItem(), BodyItem()] assert_equal([item.id for item in tc.body], ['t1-k2', 't1-k3', 't1-k4']) assert_equal(tc.setup.id, 't1-k1') assert_equal(tc.teardown.id, 't1-k5')
def test_id_with_parent(self): tc = TestCase() tc.body = [BodyItem(), BodyItem(), BodyItem()] assert_equal([item.id for item in tc.body], ['t1-k1', 't1-k2', 't1-k3'])
def test_id_without_parent(self): item = BodyItem() item.parent = None assert_equal(item.id, 'k1')