From e25264ce5094f6d288cdf780bb99e4bdb605c706 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 6 Apr 2017 09:35:05 -0700 Subject: py2/3 fix mode='r' --- test/gettext/POTUpdate/UserExamples.py | 40 +++++++++++++++++----------------- test/gettext/POUpdate/UserExamples.py | 36 +++++++++++++++--------------- test/gettext/Translate/UserExamples.py | 28 ++++++++++++------------ 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/test/gettext/POTUpdate/UserExamples.py b/test/gettext/POTUpdate/UserExamples.py index 6269081..06203fa 100644 --- a/test/gettext/POTUpdate/UserExamples.py +++ b/test/gettext/POTUpdate/UserExamples.py @@ -62,19 +62,19 @@ test.must_not_exist( ['ex1', 'po', 'bar.pot'] ) test.run(arguments = 'foo.pot', chdir = path.join('ex1', 'po')) test.must_exist( ['ex1', 'po', 'foo.pot'] ) test.must_not_exist( ['ex1', 'po', 'bar.pot'] ) -test.must_contain( ['ex1', 'po', 'foo.pot'], "Hello from a.cpp" ) -test.must_contain( ['ex1', 'po', 'foo.pot'], "Hello from b.cpp" ) -test.must_not_contain( ['ex1', 'po', 'foo.pot'], "Hello from c.cpp" ) -test.must_not_contain( ['ex1', 'po', 'foo.pot'], "Hello from d.cpp" ) +test.must_contain( ['ex1', 'po', 'foo.pot'], "Hello from a.cpp", mode='r') +test.must_contain( ['ex1', 'po', 'foo.pot'], "Hello from b.cpp", mode='r') +test.must_not_contain( ['ex1', 'po', 'foo.pot'], "Hello from c.cpp", mode='r') +test.must_not_contain( ['ex1', 'po', 'foo.pot'], "Hello from d.cpp", mode='r') # scons 'pot-update' creates foo.pot and bar.pot test.run(arguments = 'pot-update', chdir = path.join('ex1', 'po')) test.must_exist( ['ex1', 'po', 'foo.pot'] ) test.must_exist( ['ex1', 'po', 'bar.pot'] ) -test.must_not_contain( ['ex1', 'po', 'bar.pot'], "Hello from a.cpp" ) -test.must_not_contain( ['ex1', 'po', 'bar.pot'], "Hello from b.cpp" ) -test.must_contain( ['ex1', 'po', 'bar.pot'], "Hello from c.cpp" ) -test.must_contain( ['ex1', 'po', 'bar.pot'], "Hello from d.cpp" ) +test.must_not_contain( ['ex1', 'po', 'bar.pot'], "Hello from a.cpp", mode='r') +test.must_not_contain( ['ex1', 'po', 'bar.pot'], "Hello from b.cpp", mode='r') +test.must_contain( ['ex1', 'po', 'bar.pot'], "Hello from c.cpp", mode='r') +test.must_contain( ['ex1', 'po', 'bar.pot'], "Hello from d.cpp", mode='r') # scons -c does not clean anything test.run(arguments = '-c', chdir = path.join('ex1', 'po')) @@ -101,16 +101,16 @@ test.write(['ex2', 'd.cpp'], """ gettext("Hello from d.cpp") """) test.run(arguments = 'pot-update', chdir = path.join('ex2')) test.must_exist( ['ex2', 'foo.pot']) -test.must_contain( ['ex2', 'foo.pot'], "Hello from a.cpp" ) -test.must_contain( ['ex2', 'foo.pot'], "Hello from b.cpp" ) -test.must_not_contain( ['ex2', 'foo.pot'], "Hello from c.cpp" ) -test.must_not_contain( ['ex2', 'foo.pot'], "Hello from d.cpp" ) +test.must_contain( ['ex2', 'foo.pot'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex2', 'foo.pot'], "Hello from b.cpp", mode='r' ) +test.must_not_contain( ['ex2', 'foo.pot'], "Hello from c.cpp", mode='r' ) +test.must_not_contain( ['ex2', 'foo.pot'], "Hello from d.cpp", mode='r' ) test.must_exist( ['ex2', 'bar.pot']) -test.must_not_contain( ['ex2', 'bar.pot'], "Hello from a.cpp" ) -test.must_not_contain( ['ex2', 'bar.pot'], "Hello from b.cpp" ) -test.must_contain( ['ex2', 'bar.pot'], "Hello from c.cpp" ) -test.must_contain( ['ex2', 'bar.pot'], "Hello from d.cpp" ) +test.must_not_contain( ['ex2', 'bar.pot'], "Hello from a.cpp", mode='r' ) +test.must_not_contain( ['ex2', 'bar.pot'], "Hello from b.cpp", mode='r' ) +test.must_contain( ['ex2', 'bar.pot'], "Hello from c.cpp", mode='r' ) +test.must_contain( ['ex2', 'bar.pot'], "Hello from d.cpp", mode='r' ) ############################################################################# @@ -192,9 +192,9 @@ test.write(['ex5', '0', '1', 'a.cpp'], """ gettext("Hello from ../a.cpp") """) test.run(arguments = 'pot-update', chdir = path.join('ex5', '0', '1', 'po')) test.must_exist( ['ex5', '0', '1', 'po', 'messages.pot']) test.must_contain( ['ex5', '0', '1', 'po', 'messages.pot'], - 'Hello from ../a.cpp' ) + 'Hello from ../a.cpp', mode='r' ) test.must_not_contain( ['ex5', '0', '1', 'po', 'messages.pot'], - 'Hello from ../../a.cpp' ) + 'Hello from ../../a.cpp', mode='r' ) test.write(['ex5', '0', '1', 'po', 'SConstruct'], """ @@ -204,9 +204,9 @@ env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../']) """) test.run(arguments = 'pot-update', chdir = path.join('ex5', '0', '1', 'po')) test.must_contain( ['ex5', '0', '1', 'po', 'messages.pot'], - 'Hello from ../../a.cpp' ) + 'Hello from ../../a.cpp', mode='r' ) test.must_not_contain( ['ex5', '0', '1', 'po', 'messages.pot'], - 'Hello from ../a.cpp') + 'Hello from ../a.cpp', mode='r') test.pass_test() diff --git a/test/gettext/POUpdate/UserExamples.py b/test/gettext/POUpdate/UserExamples.py index 01d3706..5f3e6c7 100644 --- a/test/gettext/POUpdate/UserExamples.py +++ b/test/gettext/POUpdate/UserExamples.py @@ -182,8 +182,8 @@ test.write(['ex1', 'pl.po'], pl_po_contents) test.run(arguments = 'po-update', chdir = 'ex1', stderr = None) test.must_exist( ['ex1', 'en.po'] ) test.must_exist( ['ex1', 'pl.po'] ) -test.must_contain( ['ex1', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex1', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex1', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex1', 'pl.po'], "Hello from a.cpp", mode='r' ) ############################################################################# # POUpdate: Example 2 @@ -205,8 +205,8 @@ test.write(['ex2', 'pl.po'], pl_po_contents) test.run(arguments = 'po-update', chdir = 'ex2', stderr = None) test.must_exist( ['ex2', 'en.po'] ) test.must_exist( ['ex2', 'pl.po'] ) -test.must_contain( ['ex2', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex2', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex2', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex2', 'pl.po'], "Hello from a.cpp", mode='r' ) ############################################################################# # POUpdate: Example 3 @@ -228,8 +228,8 @@ test.write(['ex3', 'pl.po'], pl_po_contents) test.run(arguments = 'po-update', chdir = 'ex3', stderr = None) test.must_exist( ['ex3', 'en.po'] ) test.must_exist( ['ex3', 'pl.po'] ) -test.must_contain( ['ex3', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex3', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex3', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex3', 'pl.po'], "Hello from a.cpp", mode='r' ) ############################################################################# # POUpdate: Example 4 @@ -258,8 +258,8 @@ test.run(arguments = 'po-update', chdir = 'ex4', stderr = None) test.must_exist( ['ex4', 'messages.pot'] ) test.must_exist( ['ex4', 'en.po'] ) test.must_exist( ['ex4', 'pl.po'] ) -test.must_contain( ['ex4', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex4', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex4', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex4', 'pl.po'], "Hello from a.cpp", mode='r' ) ############################################################################# # POUpdate: Example 5 @@ -286,8 +286,8 @@ test.write(['ex5', 'pl.po'], pl_po_contents) test.run(arguments = 'po-update', chdir= 'ex5', stderr = None) test.must_exist( ['ex5', 'en.po'] ) test.must_exist( ['ex5', 'pl.po'] ) -test.must_contain( ['ex5', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex5', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex5', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex5', 'pl.po'], "Hello from a.cpp", mode='r' ) ############################################################################# # POUpdate: Example 6 @@ -317,10 +317,10 @@ test.must_exist( ['ex6', 'en.po'] ) test.must_exist( ['ex6', 'pl.po'] ) test.must_exist( ['ex6', 'de.po'] ) test.must_exist( ['ex6', 'fr.po'] ) -test.must_contain( ['ex6', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex6', 'pl.po'], "Hello from a.cpp" ) -test.must_contain( ['ex6', 'de.po'], "Hello from a.cpp" ) -test.must_contain( ['ex6', 'fr.po'], "Hello from a.cpp" ) +test.must_contain( ['ex6', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex6', 'pl.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex6', 'de.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex6', 'fr.po'], "Hello from a.cpp", mode='r' ) ############################################################################# # POUpdate: Example 7 @@ -351,8 +351,8 @@ test.write(['ex7', 'messages.pot'], pot_contents) test.run(arguments = 'po-update', chdir= 'ex7', stderr = None) test.must_exist( ['ex7', 'en.po'] ) test.must_exist( ['ex7', 'pl.po'] ) -test.must_contain( ['ex7', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex7', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex7', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex7', 'pl.po'], "Hello from a.cpp", mode='r' ) ############################################################################# # POUpdate: Example 8 @@ -389,8 +389,8 @@ test.run(arguments = 'po-update', chdir = 'ex8', stderr = None) test.must_exist( ['ex8', 'foo.pot'] ) test.must_exist( ['ex8', 'en.po'] ) test.must_exist( ['ex8', 'pl.po'] ) -test.must_contain( ['ex8', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex8', 'pl.po'], "Hello from a.cpp" ) +test.must_contain( ['ex8', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex8', 'pl.po'], "Hello from a.cpp", mode='r' ) test.pass_test() diff --git a/test/gettext/Translate/UserExamples.py b/test/gettext/Translate/UserExamples.py index 384b96d..d7220a3 100644 --- a/test/gettext/Translate/UserExamples.py +++ b/test/gettext/Translate/UserExamples.py @@ -65,10 +65,10 @@ test.write(['ex1', 'b.cpp'], """ gettext("Hello from b.cpp") """) test.run(arguments = 'po-update', chdir = path.join('ex1','po'), stderr = None) test.must_exist( ['ex1', 'po', 'en.po'] ) test.must_exist( ['ex1', 'po', 'pl.po'] ) -test.must_contain( ['ex1', 'po', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex1', 'po', 'en.po'], "Hello from b.cpp" ) -test.must_contain( ['ex1', 'po', 'pl.po'], "Hello from a.cpp" ) -test.must_contain( ['ex1', 'po', 'pl.po'], "Hello from b.cpp" ) +test.must_contain( ['ex1', 'po', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex1', 'po', 'en.po'], "Hello from b.cpp", mode='r' ) +test.must_contain( ['ex1', 'po', 'pl.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex1', 'po', 'pl.po'], "Hello from b.cpp", mode='r' ) ############################################################################# # Translate: Example 2 @@ -100,10 +100,10 @@ test.write(['ex2', 'b.cpp'], """ gettext("Hello from b.cpp") """) test.run(arguments = 'po-update', chdir = path.join('ex2','po'), stderr = None) test.must_exist( ['ex2', 'po', 'en.po'] ) test.must_exist( ['ex2', 'po', 'pl.po'] ) -test.must_contain( ['ex2', 'po', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex2', 'po', 'en.po'], "Hello from b.cpp" ) -test.must_contain( ['ex2', 'po', 'pl.po'], "Hello from a.cpp" ) -test.must_contain( ['ex2', 'po', 'pl.po'], "Hello from b.cpp" ) +test.must_contain( ['ex2', 'po', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex2', 'po', 'en.po'], "Hello from b.cpp", mode='r' ) +test.must_contain( ['ex2', 'po', 'pl.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex2', 'po', 'pl.po'], "Hello from b.cpp", mode='r' ) ############################################################################# # Translate: Example 3 @@ -157,12 +157,12 @@ test.must_not_exist( ['ex3', 'build', 'po', 'messages.pot'] ) test.must_not_exist( ['ex3', 'build', 'po', 'en.po'] ) test.must_not_exist( ['ex3', 'build', 'po', 'pl.po'] ) # -test.must_contain( ['ex3', 'src', 'po', 'messages.pot'], "Hello from a.cpp" ) -test.must_contain( ['ex3', 'src', 'po', 'messages.pot'], "Hello from b.cpp" ) -test.must_contain( ['ex3', 'src', 'po', 'en.po'], "Hello from a.cpp" ) -test.must_contain( ['ex3', 'src', 'po', 'en.po'], "Hello from b.cpp" ) -test.must_contain( ['ex3', 'src', 'po', 'pl.po'], "Hello from a.cpp" ) -test.must_contain( ['ex3', 'src', 'po', 'pl.po'], "Hello from b.cpp" ) +test.must_contain( ['ex3', 'src', 'po', 'messages.pot'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex3', 'src', 'po', 'messages.pot'], "Hello from b.cpp", mode='r' ) +test.must_contain( ['ex3', 'src', 'po', 'en.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex3', 'src', 'po', 'en.po'], "Hello from b.cpp", mode='r' ) +test.must_contain( ['ex3', 'src', 'po', 'pl.po'], "Hello from a.cpp", mode='r' ) +test.must_contain( ['ex3', 'src', 'po', 'pl.po'], "Hello from b.cpp", mode='r' ) test.run(arguments = '.', chdir = 'ex3', stderr = None) test.must_exist( ['ex3', 'build', 'po', 'en.mo'] ) -- cgit v0.12