Refactor test_code_gen
Refactor test_code_gen

  - Add function to return canonical text representation,
    and use it from assertion functions

  - Add function that compares ASTs rather than source code

berkerpeksag/astor