'Tests that the encoding and decoding functions are inverses.'

def test_inverse(self):

    for T in nx.nonisomorphic_trees(4):
        T2 = nx.from_prufer_sequence(nx.to_prufer_sequence(T))
        assert_nodes_equal(list(T), list(T2))
        assert_edges_equal(list(T.edges()), list(T2.edges()))
    for seq in product(range(4), repeat=2):
        seq2 = nx.to_prufer_sequence(nx.from_prufer_sequence(seq))
        assert_equal(list(seq), seq2)
