Testing our application

We've implemented our application as a Tk object that acts not only as a main window but as a controller, patching together models and views defined elsewhere in the application. As you may expect, patch() is going to figure heavily into our testing code as we mock out all of those other components to isolate Application. Let's take a look at how this is done:

  1. In a new file called test_application.py, import unittest and application. Now start a test case as follows:
class TestApplication(TestCase):
    records = [
        {'Blossoms': '21', 'Date': '2018-06-01',         'Equipment Fault': 'False', 'Fruit': '3,          'Humidity': '24.09', 'Lab': 'A', 'Light': '1.03',          'Max Height': '8.7', 'Median Height': '2.73',  'Min Height': '1.67','Notes': ...

Get Python GUI Programming with Tkinter now with O’Reilly online learning.

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