Skip to content

Commit 9c5b3d6

Browse files
committed
Make content of tests more "natural in feel"
Since we anyways load the test data from self.test, we might as well do that from template and removed duplication.
1 parent 9a183d2 commit 9c5b3d6

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

json_minify/test_json_minify.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,23 @@ class JsonMinifyTestCase(unittest.TestCase):
6565
]
6666
]
6767

68-
def template(self, in_string, expected):
68+
def template(self, index):
69+
in_string, expected = self.tests[index - 1]
6970
in_dict = json.loads(json_minify(in_string))
7071
expected_dict = json.loads(textwrap.dedent(expected))
7172
self.assertEqual(in_dict, expected_dict)
7273

7374
def test_1(self):
74-
self.template(*self.tests[0])
75+
self.template(1)
7576

7677
def test_2(self):
77-
self.template(*self.tests[1])
78+
self.template(2)
7879

7980
def test_3(self):
80-
self.template(*self.tests[2])
81+
self.template(3)
8182

8283
def test_4(self):
83-
self.template(*self.tests[3])
84+
self.template(4)
8485

8586
if __name__ == '__main__':
8687
unittest.main()

0 commit comments

Comments
 (0)