Datatamer / tamr-client

Programmatically interact with Tamr
https://tamr-client.readthedocs.io
Apache License 2.0
11 stars 25 forks source link

Improve test coverage #453

Closed skalish closed 4 years ago

skalish commented 4 years ago

↪️ Pull Request

Quick PR to improve test coverage of tamr_client.

For the most part, all mock server requests are now present. Testing is not included for the synchronous workflow functions (core asynchronous versions do have testing), since these are only meaningful when tested against a real Tamr instance. For instance, this PR adds mock server request/response tests related to #437, but does not satisfy the need for end-to-end testing.

Additionally, the description property of SubAttributes has been removed to align with the restrictions on the related objects in Tamr.

---------- coverage: platform darwin, python 3.6.10-final-0 ----------
Name                                            Stmts   Miss  Cover   Missing
-----------------------------------------------------------------------------
tamr_client/__init__.py                            20      0   100%
tamr_client/_beta.py                                9      3    67%   10-18
tamr_client/_types/__init__.py                     10      0   100%
tamr_client/_types/attribute.py                    33      0   100%
tamr_client/_types/auth.py                         14      0   100%
tamr_client/_types/dataset.py                      14      0   100%
tamr_client/_types/instance.py                      6      0   100%
tamr_client/_types/json.py                          2      0   100%
tamr_client/_types/operation.py                     8      0   100%
tamr_client/_types/project.py                      16      0   100%
tamr_client/_types/session.py                       2      0   100%
tamr_client/_types/transformations.py               9      0   100%
tamr_client/_types/url.py                          10      0   100%
tamr_client/attribute/__init__.py                   3      0   100%
tamr_client/attribute/_attribute.py                58      0   100%
tamr_client/attribute/sub.py                       13      0   100%
tamr_client/attribute/type.py                      41      2    95%   54, 86
tamr_client/categorization/__init__.py              2      0   100%
tamr_client/categorization/_categorization.py      23      7    70%   43-45, 55-56, 66-67
tamr_client/categorization/project.py               7      0   100%
tamr_client/dataset/__init__.py                     2      0   100%
tamr_client/dataset/_dataset.py                    78      2    97%   159-160
tamr_client/dataset/dataframe.py                   21      1    95%   15
tamr_client/dataset/record.py                      34      0   100%
tamr_client/dataset/unified.py                     24      2    92%   85-86
tamr_client/exception.py                            2      0   100%
tamr_client/instance.py                             7      0   100%
tamr_client/mastering/__init__.py                   2      0   100%
tamr_client/mastering/_mastering.py                49     17    65%   21-23, 32-33, 43-44, 54-55, 65-66, 76-77, 87-88, 97-98
tamr_client/mastering/project.py                    7      0   100%
tamr_client/operation.py                           46      4    91%   54, 56, 59-60
tamr_client/primary_key.py                          5      0   100%
tamr_client/project.py                             64      0   100%
tamr_client/response.py                            17      0   100%
tamr_client/schema_mapping/__init__.py              2      0   100%
tamr_client/schema_mapping/_schema_mapping.py       7      3    57%   23-25
tamr_client/schema_mapping/project.py               7      0   100%
tamr_client/session.py                              6      0   100%
tamr_client/transformations.py                     22      0   100%
-----------------------------------------------------------------------------
TOTAL                                             702     41    94%

✔️ PR Todo

pcattori commented 4 years ago

Great PR!

Note: In my mind, coverage is not the end-goal but rather a means towards the end-goal of having tests that give you confidence in your codebase. So no one should mistake this PR as acceptance of coverage % as something we wish to optimize. Rather, we should write tests that exercise features as close to real usage in the wild as possible and write tests only if they increase our confidence in our code. Writing a test that increases coverage but tests something that is trivially correct just adds to maintenance without increasing confidence.

^Mostly wrote this for onlookers as I think @skalish and I are already on the same page 😄