def test_stringify_leadingWhitespaceFalse(self):
        """Test stringify when the includeLeadingWhitespace parameter is False."""
        unit = GcodeParser()
        unit.parse("   G28")

        result = unit.stringify(includeLeadingWhitespace=False)

        self.assertEqual(result, "G28", "The result should have the leading whitespace removed")
    def test_stringify_leadingWhitespaceTrue(self):
        """Test stringify when the includeLeadingWhitespace parameter is True."""
        unit = GcodeParser()
        unit.parse("   G28")

        result = unit.stringify(includeLeadingWhitespace=True)

        self.assertEqual(result, "   G28", "The result should be the original text")
    def test_stringify_notGcodeText(self):
        """Test stringify when the text is not a valid Gcode line."""
        unit = GcodeParser()
        unit.parse("not gcode")

        result = unit.stringify()

        self.assertEqual(result, "not gcode", "The result should be the original text")
    def test_stringify_lineNumberFalse_checksumFalse(self):
        """Test stringify when includeLineNumber=False and includeChecksum=False."""
        unit = GcodeParser()
        unit.parse("N123   G28")

        result = unit.stringify(includeLineNumber=False, includeChecksum=False)

        self.assertEqual(
            result, "G28",
            "The expected result should be returned"
        )
    def test_stringify_defaults(self):
        """Test stringify when no parameters are supplied."""
        unit = GcodeParser()

        unit.parse("   N0123   G028  X  *107   ; Comment   \r\n")

        result = unit.stringify()

        self.assertEqual(
            result, "   N123 G28 X *75 ; Comment   \r\n",
            "The result should be the normalized text"
        )
    def test_stringify_includeEolFalse(self):
        """Test stringify when includeEol=False."""
        unit = GcodeParser()

        unit.parse("G 28\n")
        self.assertEqual(unit.eol, "\n", "The eol should be '\\n'")

        result = unit.stringify(includeEol=False)

        self.assertEqual(
            result, "G28",
            "The expected result should be returned"
        )
    def test_stringify_includeCommentFalse_withComment(self):
        """Test stringify when includeComment=False and there is a comment."""
        unit = GcodeParser()

        unit.parse("G 28   ; My comment")
        self.assertIsNotNone(unit.comment, "The comment property should not be None")

        result = unit.stringify(includeComment=False)

        self.assertEqual(
            result, "G28",
            "The expected result should be returned"
        )
    def test_stringify_includeCommentTrue_commentNone(self):
        """Test stringify when includeComment=True and there is no comment."""
        unit = GcodeParser()

        unit.parse("G 28")
        self.assertIsNone(unit.comment, "The comment property should be None")

        result = unit.stringify(includeComment=True)

        self.assertEqual(
            result, "G28",
            "The expected result should be returned"
        )
    def test_stringify_parametersNotNone(self):
        """Test stringify when the parameters property is not None."""
        unit = GcodeParser()

        unit.parse("G 28 X  Y")
        self.assertIsNotNone(unit.parameters, "The parameters property should not be None")

        result = unit.stringify()

        self.assertEqual(
            result, "G28 X  Y",
            "The expected result should be returned"
        )
    def test_stringify_subCodeNotNone(self):
        """Test stringify when the subCode is not None."""
        unit = GcodeParser()

        unit.parse("G 28.1")
        self.assertIsNotNone(unit.subCode, "The subCode property should not be None")

        result = unit.stringify()

        self.assertEqual(
            result, "G28.1",
            "The expected result should be returned"
        )