def test_commandString_cached(self):
        """Test the commandString property when a value is already cached."""
        unit = GcodeParser()
        unit._commandString = "foo"  # pylint: disable=protected-access

        with mock.patch.object(unit, 'stringify') as mockStringify:
            result = unit.commandString

            mockStringify.assert_not_called()
            self.assertEqual(result, "foo", "The result should be the cached value.")
    def test_commandString_notCached(self):
        """Test the commandString property when no value is cached."""
        unit = GcodeParser()
        unit._commandString = None  # pylint: disable=protected-access

        with mock.patch.object(unit, 'stringify') as mockStringify:
            mockStringify.return_value = "foo bar"

            result = unit.commandString

            mockStringify.assert_called_with(
                includeChecksum=False,
                includeComment=False,
                includeEol=False
            )
            self.assertEqual(result, "foo bar", "The result of stringify should be returned.")