Skip to content

Commit

Permalink
#802: add test for disappearing keys which wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed May 8, 2017
1 parent ef42840 commit 726e179
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions psutil/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,25 @@ def test_changing_keys(self):
input = {'disk1': nt(8, 8, 8)}
self.assertEqual(wrap_numbers(input, 'disk_io'), input)

def test_changing_keys_w_wrap(self):
input = {'disk1': nt(50, 50, 50),
'disk2': nt(100, 100, 100)}
self.assertEqual(wrap_numbers(input, 'disk_io'), input)
# disk 2 wraps
input = {'disk1': nt(50, 50, 50),
'disk2': nt(100, 100, 10)}
self.assertEqual(wrap_numbers(input, 'disk_io'),
{'disk1': nt(50, 50, 50),
'disk2': nt(100, 100, 110)})
# disk 2 disappears
input = {'disk1': nt(50, 50, 50)}
self.assertEqual(wrap_numbers(input, 'disk_io'), input)
# then it appears again; the old wrap is supposed to be
# gone.
input = {'disk1': nt(50, 50, 50),
'disk2': nt(100, 100, 100)}
self.assertEqual(wrap_numbers(input, 'disk_io'), input)


# ===================================================================
# --- Example script tests
Expand Down

0 comments on commit 726e179

Please sign in to comment.