def test_compute_change_lost_proc(self): """ Process that only appears in ``before`` is ignored. """ labels = ['node1'] before = [{'foo': 555, 'bar': 5}] after = [{'foo': 600}] result = compute_change(labels, before, after) self.assertNotIn('bar', result['node1'])
def test_compute_change(self): """ Process measurements are handled correctly. """ labels = ['node1', 'node2'] before = [{'foo': 3, 'bar': 5}, {'foo': 10, 'bar': 2}] after = [{'foo': 4, 'bar': 5}, {'foo': 12, 'bar': 5}] result = compute_change(labels, before, after) self.assertEqual(result, { 'node1': {'foo': 1, 'bar': 0}, 'node2': {'foo': 2, 'bar': 3}, })