From 298a4ff1dca7c75993eae2317a777829828ae04a Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 24 Jan 2022 13:57:51 -0800 Subject: Finish up this coverage stuff. --- tests/dict_utils_test.py | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'tests/dict_utils_test.py') diff --git a/tests/dict_utils_test.py b/tests/dict_utils_test.py index 9fb8157..a8f6273 100755 --- a/tests/dict_utils_test.py +++ b/tests/dict_utils_test.py @@ -3,11 +3,10 @@ import unittest import dict_utils as du -import unittest_utils # Needed for --unittests_ignore_perf flag +import unittest_utils # Needed for --unittests_ignore_perf flag class TestDictUtils(unittest.TestCase): - def test_init_or_inc(self): d = {} du.init_or_inc(d, 'a') @@ -20,41 +19,31 @@ class TestDictUtils(unittest.TestCase): du.init_or_inc(d, 'e') du.init_or_inc(d, 'a') du.init_or_inc(d, 'b') - e = { - 'a': 3, 'b': 3, 'c': 2, 'd': 1, 'e': 1 - } + e = {'a': 3, 'b': 3, 'c': 2, 'd': 1, 'e': 1} self.assertEqual(d, e) def test_shard_coalesce(self): - d = { - 'a': 3, 'b': 3, 'c': 2, 'd': 1, 'e': 1 - } + d = {'a': 3, 'b': 3, 'c': 2, 'd': 1, 'e': 1} shards = du.shard(d, 2) merged = du.coalesce(shards) self.assertEqual(d, merged) def test_item_with_max_value(self): - d = { - 'a': 4, 'b': 3, 'c': 2, 'd': 1, 'e': 1 - } + d = {'a': 4, 'b': 3, 'c': 2, 'd': 1, 'e': 1} self.assertEqual('a', du.item_with_max_value(d)[0]) self.assertEqual(4, du.item_with_max_value(d)[1]) self.assertEqual('a', du.key_with_max_value(d)) self.assertEqual(4, du.max_value(d)) def test_item_with_min_value(self): - d = { - 'a': 4, 'b': 3, 'c': 2, 'd': 1, 'e': 0 - } + d = {'a': 4, 'b': 3, 'c': 2, 'd': 1, 'e': 0} self.assertEqual('e', du.item_with_min_value(d)[0]) self.assertEqual(0, du.item_with_min_value(d)[1]) self.assertEqual('e', du.key_with_min_value(d)) self.assertEqual(0, du.min_value(d)) def test_min_max_key(self): - d = { - 'a': 4, 'b': 3, 'c': 2, 'd': 1, 'e': 0 - } + d = {'a': 4, 'b': 3, 'c': 2, 'd': 1, 'e': 0} self.assertEqual('a', du.min_key(d)) self.assertEqual('e', du.max_key(d)) -- cgit v1.3