def test_buildCommand_argValueEmptyString(self): """Test buildCommand when passed a GCode command and a kwarg set to empty string.""" unit = GcodeParser() result = unit.buildCommand("G0", X="") self.assertEqual(result, "G0 X", "The returned command should be 'G0 X'")
def test_buildCommand_argValueNone(self): """Test buildCommand when passed a GCode command and a kwarg set to None.""" unit = GcodeParser() result = unit.buildCommand("G0", X=None) self.assertEqual(result, "G0 X", "The returned command should be 'G0 X'")
def test_buildCommand_one_kwarg(self): """Test buildCommand when passed a GCode command and one kwargs.""" unit = GcodeParser() result = unit.buildCommand("G0", X=10) self.assertEqual(result, "G0 X10", "The returned command should be 'G0 X10'")
def test_buildCommand_no_kwargs(self): """Test buildCommand when passed a GCode command and no kwargs.""" unit = GcodeParser() result = unit.buildCommand("G0") self.assertEqual(result, "G0", "The returned command should be 'G0'")
def test_buildCommand_two_kwargs(self): """Test buildCommand when passed a GCode command and two kwargs.""" unit = GcodeParser() result = unit.buildCommand("G0", X=10, Y=20) self.assertRegexpMatches(result, "^G0 ", "The returned command should start with 'G0 '") # Due to kwargs, order of arguments is not guaranteed, and also is not required self.assertRegexpMatches(result, " X10( |$)", "The returned command should contain ' X10'") self.assertRegexpMatches(result, " Y20( |$)", "The returned command should contain ' Y20'")