Add typing for all the TestCase functions.

Review Request #13413 — Created Nov. 14, 2023 and submitted

Information

Review Board
release-5.0.x

Reviewers

This updates all the object creation functions and utility context
managers in TestCase to provide type hints. This helps to write better
type-safe unit tests, and resolves a lot of problems that currently
exist when passing in values that default to None or accept multiple
value types.

In the process, documentation has been updated to meet current standards.

There are a couple of fixes in here. For instance, create_visit()
ignored the timestamp field and didn't normalize user correctly, and
http_request() passed in bad empty arguments when constructing a
ResolverMatch. These have been addressed.

All unit tests pass.

Summary ID
Add typing for all the TestCase functions.
This updates all the object creation functions and utility context managers in `TestCase` to provide type hints. This helps to write better type-safe unit tests, and resolves a lot of problems that currently exist when passing in values that default to `None` or accept multiple value types. There are a couple of fixes in here. For instance, `create_visit()` ignored the `timestamp` field and didn't normalize `user` correctly, and `http_request()` passed in bad empty arguments when constructing a `ResolverMatch`. These have been addressed.
9387935ea0bda2c90813a8a76b66024ee2bf4857
Description From Last Updated

This doesn't seem like a valuable thing to include in the version changed documentation. Type hints don't change the signature …

daviddavid
david
  1. 
      
  2. reviewboard/testing/testcase.py (Diff revision 1)
     
     
     
     
    Show all issues

    This doesn't seem like a valuable thing to include in the version changed documentation. Type hints don't change the signature or behavior of the method at all.

  3. 
      
chipx86
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-5.0.x (f7832f8)
Loading...