def test_prepare_string_argument_sh(self): expected_results = ('"normal_string"', '"string with spaces"', '"string with quotes\\"a"', '"string with s-quotes\'b"', '"bsn \n A"', '"unrecognized \\q escape"') for string, result in zip(self.test_strings, expected_results): self.assertEqual(prepare_string_argument(string, "sh"), result)
def test_prepare_string_argument_linux_and_darwin(self): testoses = ("Linux", "Darwin") expected_results = ('"normal_string"', '"string with spaces"', '"string with quotes\\"a"', '"string with s-quotes\'b"', '"bsn \n A"', '"unrecognized \\q escape"') for string, result in zip(self.test_strings, expected_results): for testos in testoses: self.assertEqual(prepare_string_argument(string, testos), result)
def test_prepare_string_argument_unsupported(self): for string in self.test_strings: self.assertEqual(prepare_string_argument(string, "WeIrD_O/S"), string)
def test_prepare_string_argument_unsupported_os(self): testos = "WeIrD_O/S" for string in self.test_strings: self.assertEqual(prepare_string_argument(string, testos), string)