def test_parseLines_singleLine(self): """Test parseLines when passed a string containing a single line.""" unit = GcodeParser() result = [] for item in unit.parseLines("command 1"): result.append(item.fullText) self.assertEqual(result, ["command 1"], "The expected lines should be parsed")
def test_parseLines_emptyString(self): """Test parseLines when passed an empty string.""" unit = GcodeParser() result = [] for item in unit.parseLines(""): result.append(item.fullText) self.assertEqual(result, [], "No lines should be parsed")
def test_parseLines_blankLine(self): """Test parseLines when passed a single line ending.""" unit = GcodeParser() result = [] for item in unit.parseLines("\n"): result.append(item.fullText) self.assertEqual(result, ["\n"], "The expected lines should be parsed")
def test_parseLines_None(self): """Test parseLines parses the current source when passed None.""" unit = GcodeParser() unit.source = "command 1" result = [] for item in unit.parseLines(None): result.append(item.fullText) self.assertEqual(result, ["command 1"], "The expected commands should be parsed")
def test_parseLines_offset(self): """Test parseLines when passed an offset value.""" unit = GcodeParser() result = [] for item in unit.parseLines("command 1\rcommand 2\rcommand 3", 10): result.append(item.fullText) self.assertEqual( result, ["command 2\r", "command 3"], "The expected lines should be parsed" )