Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_read_write(tmpdir):
trees = read(pathlib.Path(__file__).parent / 'fixtures' / 'tree-glottolog-newick.txt')
descs = [len(tree.descendants) for tree in trees]
# The bookkeeping family has 391 languages
assert descs[0] == 391
tmp = str(tmpdir.join('test.txt'))
write(trees, tmp)
assert pathlib.Path(tmp).exists()
assert [len(tree.descendants) for tree in read(tmp)] == descs