diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-12-01 09:00:56 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-12-01 09:01:33 +0100 |
commit | 4473c31b8c32d12fbd46839ee2a767040573919a (patch) | |
tree | 983dcebf8092ad1d867c44383ed725150cfe455a | |
parent | 3e348dcc926a9169e7c1c37e53b8da10612596aa (diff) | |
download | json_diff-4473c31b8c32d12fbd46839ee2a767040573919a.tar.gz |
One more python 2.4 compatibility fix.
Maintainer of optparse library couldn't have a better idea than to change
"usage:" to "Usage:" (between 2.4 and 2.6)! Grrrrrrr.
-rwxr-xr-x | json_diff.py | 2 | ||||
-rw-r--r-- | test_json_diff.py | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/json_diff.py b/json_diff.py index 4f6f495..b7b44fc 100755 --- a/json_diff.py +++ b/json_diff.py @@ -32,7 +32,7 @@ import logging from optparse import OptionParser __author__ = "Matěj Cepl" -__version__ = "1.2.2" +__version__ = "1.2.3" import locale diff --git a/test_json_diff.py b/test_json_diff.py index 377a4cf..ff63e3e 100644 --- a/test_json_diff.py +++ b/test_json_diff.py @@ -177,21 +177,28 @@ class TestMainArgsMgmt(unittest.TestCase): except SystemExit: save_stdout.seek(0) sys.stdout = sys.__stdout__ - expected = "Usage:" - observed = save_stdout.read() + expected = "usage:" + observed = save_stdout.read().lower() self.assertEquals(observed[:len(expected)], expected, - "testing -h usage message") + "testing -h usage message" + + "\n\nexpected = %s\n\nobserved = %s" % + (expected, observed)) def test_args_run_same(self): save_stdout = StringIO() sys.stdout = save_stdout + cur_loc = locale.getlocale() + locale.setlocale(locale.LC_ALL, "cs_CZ.utf8") res = json_diff.main(["./test_json_diff.py", "test/old.json", "test/old.json"]) sys.stdout = sys.__stdout__ - self.assertEquals(res, 0, "testing -h usage message") + locale.setlocale(locale.LC_ALL, cur_loc) + self.assertEquals(res, 0, "comparing same file" + + "\n\nexpected = %d\n\nobserved = %d" % + (0, res)) def test_args_run_different(self): save_stdout = StringIO() @@ -204,7 +211,9 @@ class TestMainArgsMgmt(unittest.TestCase): sys.stdout = sys.__stdout__ locale.setlocale(locale.LC_ALL, cur_loc) - self.assertEquals(res, 1, "testing -h usage message") + self.assertEqual(res, 1, "comparing different files" + + "\n\nexpected = %d\n\nobserved = %d" % + (1, res)) if __name__ == "__main__": unittest.main() |