Creating tests for an analytical application

Tests are required to make sure the application we have built works correctly. To enable testing, you need to create the testbench sub-folder with the testAggregator.py file in the aggregator folder. The testAggregator.py file should contain the following code:

from analytic import aggregatorif __name__ == "__main__":   a = aggregator()   assert a.sum('{"timeseries": [[1501664960967,12,3],[1501664961973,48,3]]}') == {"result": 60}

Get Industrial Internet Application Development 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.