Unit testing BaseDataObject

Unit testing of BaseDataObject is going to be… interesting, as it stands right now. Testing the matches method, a concrete method that depends on an abstract method (to_data_dict), which, in turn depends on the actual data structure (properties) of a derived class, is either not possible or meaningless in the context of the test case class for BaseDataObject itself:

  • In order to test matches, we have to define a non-abstract class with a concrete implementation of to_data_dict, and some actual properties to generate that resulting dict from/with
  • That derived class, unless it also happens to be an actual class needed in the system, has no relevance in the final system's code, so tests there do not assure us that ...

Get Hands-On Software Engineering with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.