Example #1
0
    def test_parsing(self):
        """ Tests whether correctly indented file can be parsed
		"""
        with open("test.data", "r") as input_file:
            rawdata = input_file.read()
        a = parse_indentation(rawdata)
        self.assertEqual(a, good_output)
	def test_parsing(self):
		""" Tests whether correctly indented file can be parsed
		"""
		with open ("test.data", "r") as input_file:
		    rawdata = input_file.read()
		a = parse_indentation(rawdata)
		self.assertEqual(a,good_output)
Example #3
0
    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:
            with open("test1.data", "r") as input_file:
                rawdata = input_file.read()
            warnings.simplefilter("always")
            a = parse_indentation(rawdata)
        self.assertEqual(a, good_output)
        self.assertEqual(len(w), 1)
        self.assertEqual(str(w[0].message), 'Indentation with errors!')
	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:
			with open ("test1.data", "r") as input_file:
				rawdata = input_file.read()
			warnings.simplefilter("always")
			a = parse_indentation(rawdata)
		self.assertEqual(a,good_output)
		self.assertEqual(len(w),1)
		self.assertEqual(str(w[0].message),'Indentation with errors!')