Browse Source

Moves test case definitions into the function they're used in

master
Noah Pederson 1 year ago
parent
commit
0ef063fde6
1 changed files with 3 additions and 6 deletions
  1. +3
    -6
      tests/test_find_closest.py

+ 3
- 6
tests/test_find_closest.py View File

@@ -7,9 +7,8 @@ logging.basicConfig(level=logging.INFO)

class FindClosesTestCase(TestCase):


def setUp(self):
self.test_cases = [
def test_bulk(self):
test_cases = [
# list, target, expected
([1, 2, 3, 4, 5, 6], 3, 3),
([1, 2, 4, 5, 6, 7], 3, 2),
@@ -21,9 +20,7 @@ class FindClosesTestCase(TestCase):
([1, 2, 3], 4, 3),
([1, 2, 3], 3, 3)
]

def test_bulk(self):
for case in self.test_cases:
for case in test_cases:
with self.subTest(target=case[1], expected=case[2]):
result = find_closest(case[0], case[1])
logging.info("expected: {} == result: {}".format(case[2], result))


Loading…
Cancel
Save