Improve type annotations for test
Exhaustively added type annotations to all test functions (there is one pending TODO though) and applied the necessary fixes for the code to be compliant.
Depends on !60 (closed).
Migrated from D5962 (view on Phabricator)