def test_warning(self): """ Tests whether file with two extra indentation spaces is parsed and creates a warning. """ with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") a = parse_indentation(self.bad_indentation) self.assertEqual(a, self.expected_output) self.assertEqual(len(w), 1) self.assertEqual(str(w[0].message), 'Indentation with errors!')
def test_parsing(self): """ Tests whether correctly indented file can be parsed """ a = parse_indentation(self.good_indentation) self.assertEqual(a, self.expected_output)