def test_append_child(): section = ExperimentSection(make_tree(['session', 'block', 'trial'], {}), ChainMap()) section.append_child(dict(test=True)) yield check_test_data, section[-1] assert section[-1].data['block'] == 7 section[-1].append_child(dict(tree=next(next(section.tree)))) for trial in section[-1]: yield check_test_data, trial section[1].append_child(dict(test=True), to_start=True) yield check_test_data, section[1][1] assert len(section[1]) == 7 assert [trial.data['trial'] for trial in section[1]] == list(range(1, 8))