Exemple #1
0
	def test_apply_temperature_offsets(self, input, offsets, current_tool, expected):
		from octoprint.util import comm
		actual = comm.apply_temperature_offsets(input, offsets, current_tool=current_tool)

		if expected is None:
			self.assertEquals(input, actual)
		else:
			import re
			match = re.search("S(\d+(\.\d+)?)", actual)
			if not match:
				self.fail("No temperature found")
			temperature = float(match.group(1))
			self.assertEquals(expected, temperature)
			self.assertEquals(input[:match.start(1)], actual[:match.start(1)])
			self.assertEquals(input[match.end(1):], actual[match.end(1):])
Exemple #2
0
	def test_apply_temperature_offsets(self, input, offsets, current_tool, expected):
		from octoprint.util import comm
		actual = comm.apply_temperature_offsets(input, offsets, current_tool=current_tool)

		if expected is None:
			self.assertEquals(input, actual)
		else:
			import re
			match = re.search("S(\d+(\.\d+)?)", actual)
			if not match:
				self.fail("No temperature found")
			temperature = float(match.group(1))
			self.assertEquals(expected, temperature)
			self.assertEquals(input[:match.start(1)], actual[:match.start(1)])
			self.assertEquals(input[match.end(1):], actual[match.end(1):])