diff options
| author | Mats Wichmann <mats@linux.com> | 2019-08-30 13:59:29 (GMT) |
|---|---|---|
| committer | Mats Wichmann <mats@linux.com> | 2019-08-30 14:04:23 (GMT) |
| commit | 49212c0d8dc8db6657735036028948bf3ab9ede0 (patch) | |
| tree | 08f0ea34bbc36d51a8234a72ea5fe65d3f44c68e /test/Java | |
| parent | 84843df640e34f83ebea25be851204f400a0d9ec (diff) | |
| download | SCons-49212c0d8dc8db6657735036028948bf3ab9ede0.zip SCons-49212c0d8dc8db6657735036028948bf3ab9ede0.tar.gz SCons-49212c0d8dc8db6657735036028948bf3ab9ede0.tar.bz2 | |
Use "in" in preference to string find method
In places where only the found/not found status is needed, use
the membership operator (in) for checks instead - makes for easier
reading and is considered faster for shorter strings.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test/Java')
| -rw-r--r-- | test/Java/RMIC.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py index c8848e9..67135b9 100644 --- a/test/Java/RMIC.py +++ b/test/Java/RMIC.py @@ -95,7 +95,7 @@ line 3 where_javac, java_version = test.java_where_javac() where_rmic = test.java_where_rmic() -# Try to get the major/minor Java version +# Try to get the major/minor Java version curver = (1, 0) if java_version.count('.') == 1: # Check Java version @@ -138,7 +138,7 @@ bar_classes = bar.Java(target = 'class2', source = 'com/sub/bar') # XXX This is kind of a Python brute-force way to do what Ant # does with its "excludes" attribute. We should probably find # a similar friendlier way to do this. -bar_classes = [c for c in bar_classes if str(c).find('Hello') == -1] +bar_classes = [c for c in bar_classes if 'Hello' not in str(c)] bar.RMIC(target = Dir('outdir2'), source = bar_classes) """ % locals() ) @@ -149,7 +149,7 @@ bar.RMIC(target = Dir('outdir2'), source = bar_classes) ['com', 'sub', 'bar'], 'src3a', 'src3b') - + test.write(['com', 'sub', 'foo', 'Hello.java'], """\ package com.sub.foo; @@ -329,16 +329,16 @@ public class Example4 extends UnicastRemoteObject implements Hello { """) test.run(arguments = '.') - + test.must_match('wrapper.out', "wrapper_with_args.py rmic -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n", mode='r') - + test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Stub.class')) test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Stub.class')) test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Stub.class')) test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Stub.class')) - + # We used to check for _Skel.class files as well, but they're not # generated by default starting with Java 1.5, and they apparently # haven't been needed for a while. Don't bother looking, even if we're @@ -348,7 +348,7 @@ public class Example4 extends UnicastRemoteObject implements Hello { #test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Skel.class')) #test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Skel.class')) #test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Skel.class')) - + test.up_to_date(arguments = '.') test.pass_test() |
