def test_a(self):
    with open('testcase.txt') as ifile:
        for iline in ifile:
            with self.subTest(line=iline):
                self.assertEqual(iline, 'it is a test!')
For loop in unittest