Alternatively, you can perform data validation with the ddt package :
DDT (Data-Driven Tests) allows you to multiply one test case by running it with different test data and making it appear as several test cases.
import unittest from ddt import ddt, data @ddt class FooTestCase(unittest.TestCase): @data('it is a test!', 'it is a test!', 'something else') def test_lines(self, value): self.assertEqual(value, 'it is a test!')
ddt may also have data coming from a file , but it must be a JSON file.
source share