diff --git a/src/pygamecfg/game_cod4.py b/src/pygamecfg/game_cod4.py index 420c80c..e8133f6 100644 --- a/src/pygamecfg/game_cod4.py +++ b/src/pygamecfg/game_cod4.py @@ -39,7 +39,7 @@ class GameOption_COD4(GameOption): self.cfgfile = open(self.mainConfigFilePath, "r", encoding="utf8") # pylint: disable=consider-using-with def format_OT_BOOLEAN(self, value: Union[int, str, float]) -> str: - return "1" if super().format_OT_BOOLEAN(value) is "True" else "0" + return "1" if super().format_OT_BOOLEAN(value).lower() == "true" else "0" def close(self) -> None: self.cfgfile.close() diff --git a/test/test_cod4.py b/test/test_cod4.py index 76399a1..19c6f24 100644 --- a/test/test_cod4.py +++ b/test/test_cod4.py @@ -79,7 +79,7 @@ class Testtest_cod4(unittest.TestCase): with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr: fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "SetOption", "oldschool", "1"]) # /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep - # self.assertEqual("setting option to: 1\n", capted_stdout.getvalue()) + self.assertEqual("setting option to: 1\n", capted_stdout.getvalue()) self.assertEqual("", capted_stderr.getvalue()) with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr: @@ -99,3 +99,15 @@ class Testtest_cod4(unittest.TestCase): # /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep self.assertEqual("0\n", capted_stdout.getvalue()) self.assertEqual("", capted_stderr.getvalue()) + + with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr: + fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "SetOption", "oldschool", "1"]) + # /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep + self.assertEqual("setting option to: 1\n", capted_stdout.getvalue()) + self.assertEqual("", capted_stderr.getvalue()) + + with redirect_stdout(StringIO()) as capted_stdout, redirect_stderr(StringIO()) as capted_stderr: + fct_main(["-g", "cod4", "-b", "test/tmp/COD4", "GetOption", "oldschool"]) + # /!\ add '\n' at the end of the string cause Python terminal newline is always this, regardless Windows / Linux os.linesep + self.assertEqual("1\n", capted_stdout.getvalue()) + self.assertEqual("", capted_stderr.getvalue())