diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-08 21:08:51 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-08 21:08:51 +0200 |
commit | 5141848f0e607c5894733297c46755be41af975c (patch) | |
tree | 63f10b252e2f6b2ab0442b652daada6448559273 | |
parent | 726e179629273f7bae3e6b38262b2cd40f224746 (diff) | |
download | psutil-5141848f0e607c5894733297c46755be41af975c.tar.gz |
#802: further tests for disappearing keys (impl is still broken)
-rw-r--r-- | psutil/_common.py | 2 | ||||
-rwxr-xr-x | psutil/tests/test_misc.py | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/psutil/_common.py b/psutil/_common.py index 202c371a..bdfcefcd 100644 --- a/psutil/_common.py +++ b/psutil/_common.py @@ -495,8 +495,8 @@ def wrap_numbers(input_dict, name): bits = [] for i in range(len(input_nt)): - old_value = old_nt[i] input_value = input_nt[i] + old_value = old_nt[i] remkey = (name, key, i) if input_value < old_value: _wrapn_reminders[remkey] += old_value diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py index 112a3f38..3e2a3ce8 100755 --- a/psutil/tests/test_misc.py +++ b/psutil/tests/test_misc.py @@ -452,11 +452,22 @@ class TestWrapNumbers(unittest.TestCase): # 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) + # remains the same + input = {'disk1': nt(50, 50, 50), + 'disk2': nt(100, 100, 100)} + self.assertEqual(wrap_numbers(input, 'disk_io'), input) + # and then wraps again + 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)}) # =================================================================== |