Unit testing BaseProduct

The test methods for the properties of BaseProduct don't require anything new; they follow the same approaches shown for properties with full get/set/delete capabilities, except for the test of the metadata property, which tests as a read-only property like the test for HasProducts.products we have just shown.

Many of the test methods for BaseProduct will also follow previously established patterns—testing for good and bad value variants of standard required and optional text lines—but there are a few that require new, or at least variant, approaches as well.

The set_metadata and remove_metadata method tests are just different enough from previous tests that they are worth a closer examination. In order to test the ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.