diff options
| author | Greg Noel <GregNoel@tigris.org> | 2010-03-27 07:39:52 (GMT) |
|---|---|---|
| committer | Greg Noel <GregNoel@tigris.org> | 2010-03-27 07:39:52 (GMT) |
| commit | 59ed0a109bf5add2efcef459080837b11066c6fb (patch) | |
| tree | fff879b4f9676a72e16c0f7b4dd969f050038b4f /src/engine/SCons/Node/FSTests.py | |
| parent | 00a3188193ba1feef927cf18e7f5fc20ad71b848 (diff) | |
| download | SCons-59ed0a109bf5add2efcef459080837b11066c6fb.zip SCons-59ed0a109bf5add2efcef459080837b11066c6fb.tar.gz SCons-59ed0a109bf5add2efcef459080837b11066c6fb.tar.bz2 | |
http://scons.tigris.org/issues/show_bug.cgi?id=2329
Applied a number of idiomatic changes.
Uses of the 'sort()' method were converted into calls of 'sorted()' when
possible and the sorted() expression was inserted into a subsequent statement
whenever that made sense.
The statement 'while 1:' was changed to 'while True:'.
Names from the 'types' module (e.g., 'types.FooType') were converted to the
equivalent build-in type (e.g., 'foo').
Comparisons between types were changed to use 'isinstance()'.
Diffstat (limited to 'src/engine/SCons/Node/FSTests.py')
| -rw-r--r-- | src/engine/SCons/Node/FSTests.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index af7638d..e68b389 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1722,8 +1722,7 @@ class DirTestCase(_tempdirTestCase): fs.Dir(os.path.join('ddd', 'd1', 'f4')) fs.Dir(os.path.join('ddd', 'd1', 'f5')) dir.scan() - kids = [x.path for x in dir.children(None)] - kids.sort() + kids = sorted([x.path for x in dir.children(None)]) assert kids == [os.path.join('ddd', 'd1'), os.path.join('ddd', 'f1'), os.path.join('ddd', 'f2'), @@ -1768,14 +1767,12 @@ class DirTestCase(_tempdirTestCase): fs.File(os.path.join('ddd', 'f1')) dir.scan() - kids = [x.path for x in dir.children()] - kids.sort() + kids = sorted([x.path for x in dir.children()]) assert kids == [os.path.join('ddd', 'f1')], kids fs.File(os.path.join('ddd', 'f2')) dir.scan() - kids = [x.path for x in dir.children()] - kids.sort() + kids = sorted([x.path for x in dir.children()]) assert kids == [os.path.join('ddd', 'f1'), os.path.join('ddd', 'f2')], kids @@ -2240,8 +2237,7 @@ class GlobTestCase(_tempdirTestCase): strings_kwargs = copy.copy(kwargs) strings_kwargs['strings'] = True for input, string_expect, node_expect in cases: - r = self.fs.Glob(input, **strings_kwargs) - r.sort() + r = sorted(self.fs.Glob(input, **strings_kwargs)) assert r == string_expect, "Glob(%s, strings=True) expected %s, got %s" % (input, string_expect, r) # Now execute all of the cases without string=True and look for @@ -2256,13 +2252,12 @@ class GlobTestCase(_tempdirTestCase): r.sort(lambda a,b: cmp(a.path, b.path)) result = [] for n in node_expect: - if type(n) == type(''): + if isinstance(n, str): n = self.fs.Entry(n) result.append(n) fmt = lambda n: "%s %s" % (repr(n), repr(str(n))) else: - r = list(map(str, r)) - r.sort() + r = sorted(map(str, r)) result = string_expect fmt = lambda n: n if r != result: |
