1. SCons
  2. Core
  3. SCons

Commits

Greg Noel  committed 2ad4940

Issue 2401: Fix usage of comparison with None, patch from Jared Grubb

  • Participants
  • Parent commits af6625a
  • Branches default

Comments (0)

Files changed (30)

File src/CHANGES.txt

View file
  • Ignore whitespace
 
     - Fix a typo in the documentation for $_CPPDEFFLAGS.
 
+    - Issue 2401: Fix usage of comparisons with None.
+
   From Ludwig Hähne:
 
     - Handle Java inner classes declared within a method.

File src/engine/SCons/ActionTests.py

View file
  • Ignore whitespace
 
         def none(a):
             assert hasattr(a, 'strfunction')
-            assert a.cmdstr == None, a.cmdstr
+            assert a.cmdstr is None, a.cmdstr
         #FUTURE test_varlist(pos_callback, none, cmd, None, **kw)
         apply(test_varlist, (pos_callback, none, cmd, None), kw)
 

File src/engine/SCons/BuilderTests.py

View file
  • Ignore whitespace
         r = builder.get_prefix(env)
         assert r == 'A_', r
         r = builder.get_suffix(env)
-        assert r == None, r
+        assert r is None, r
         r = builder.get_src_suffix(env)
         assert r == '', r
         r = builder.src_suffixes(env)
         r = builder.get_prefix(env)
         assert r == 'A_', r
         r = builder.get_suffix(env)
-        assert r == None, r
+        assert r is None, r
         r = builder.get_suffix(env, [MyNode('X.src_sfx1')])
-        assert r == None, r
+        assert r is None, r
         r = builder.get_src_suffix(env)
         assert r == '.src_sfx1', r
         r = builder.src_suffixes(env)
         r = builder.get_prefix(env)
         assert r == 'A_', r
         r = builder.get_suffix(env)
-        assert r ==  None, r
+        assert r is None, r
         r = builder.get_src_suffix(env)
         assert r == '.src_sfx1', r
         r = builder.src_suffixes(env)

File src/engine/SCons/Defaults.py

View file
  • Ignore whitespace
         return list
 
     l = f(SCons.PathList.PathList(list).subst_path(env, target, source))
-    if not l is None:
+    if l is not None:
         list = l
 
     return _concat_ixes(prefix, list, suffix, env)

File src/engine/SCons/Environment.py

View file
  • Ignore whitespace
         if source is _null:
             source = target
             target = None
-        if not target is None and not SCons.Util.is_List(target):
+        if target is not None and not SCons.Util.is_List(target):
             target = [target]
-        if not source is None and not SCons.Util.is_List(source):
+        if source is not None and not SCons.Util.is_List(source):
             source = [source]
         return apply(MethodWrapper.__call__, (self, target, source) + args, kw)
 
                 n = None
                 for l in lookup_list:
                     n = l(v)
-                    if not n is None:
+                    if n is not None:
                         break
-                if not n is None:
+                if n is not None:
                     if SCons.Util.is_String(n):
                         # n = self.subst(n, raw=1, **kw)
                         kw['raw'] = 1
 
     def CacheDir(self, path):
         import SCons.CacheDir
-        if not path is None:
+        if path is not None:
             path = self.subst(path)
         self._CacheDir_path = path
 
         return apply(SCons.Scanner.Base, nargs, nkw)
 
     def SConsignFile(self, name=".sconsign", dbm_module=None):
-        if not name is None:
+        if name is not None:
             name = self.subst(name)
             if not os.path.isabs(name):
                 name = os.path.join(str(self.fs.SConstruct_dir), name)

File src/engine/SCons/EnvironmentTests.py

View file
  • Ignore whitespace
                                  'builder2' : b2 })
         called_it = {}
         env.builder1('in1')
-        assert called_it['target'] == None, called_it
+        assert called_it['target'] is None, called_it
         assert called_it['source'] == ['in1'], called_it
 
         called_it = {}
         env.builder2(source = 'in2', xyzzy = 1)
-        assert called_it['target'] == None, called_it
+        assert called_it['target'] is None, called_it
         assert called_it['source'] == ['in2'], called_it
         assert called_it['xyzzy'] == 1, called_it
 
         called_it = {}
         env.builder1(foo = 'bar')
         assert called_it['foo'] == 'bar', called_it
-        assert called_it['target'] == None, called_it
-        assert called_it['source'] == None, called_it
+        assert called_it['target'] is None, called_it
+        assert called_it['source'] is None, called_it
 
     def test_BuilderWrapper_attributes(self):
         """Test getting and setting of BuilderWrapper attributes
 
         assert paths[0] == env.FindIxes(paths, 'LIBPREFIX', 'LIBSUFFIX')
         assert paths[1] == env.FindIxes(paths, 'SHLIBPREFIX', 'SHLIBSUFFIX')
-        assert None == env.FindIxes(paths, 'PREFIX', 'POST')
+        assert None is env.FindIxes(paths, 'PREFIX', 'POST')
 
         paths = ['libfoo.a', 'prefoopost']
 
         assert paths[0] == env.FindIxes(paths, 'LIBPREFIX', 'LIBSUFFIX')
-        assert None == env.FindIxes(paths, 'SHLIBPREFIX', 'SHLIBSUFFIX')
+        assert None is env.FindIxes(paths, 'SHLIBPREFIX', 'SHLIBSUFFIX')
         assert paths[1] == env.FindIxes(paths, 'PREFIX', 'SUFFIX')
 
     def test_ParseConfig(self):
         env = self.TestEnvironment(FOO = 'xyzzy')
 
         b = env.Builder(action = 'foo')
-        assert not b is None, b
+        assert b is not None, b
 
         b = env.Builder(action = '$FOO')
-        assert not b is None, b
+        assert b is not None, b
 
         b = env.Builder(action = ['$FOO', 'foo'])
-        assert not b is None, b
+        assert b is not None, b
 
         def func(arg):
             pass
         b = env.Builder(action = func)
-        assert not b is None, b
+        assert b is not None, b
         b = env.Builder(generator = func)
-        assert not b is None, b
+        assert b is not None, b
 
     def test_CacheDir(self):
         """Test the CacheDir() method"""
         env = Environment()
         t = env.Command(target='foo.out', source=['foo1.in', 'foo2.in'],
                         action='buildfoo $target $source')[0]
-        assert not t.builder is None
+        assert t.builder is not None
         assert t.builder.action.__class__.__name__ == 'CommandAction'
         assert t.builder.action.cmd_list == 'buildfoo $target $source'
         assert 'foo1.in' in map(lambda x: x.path, t.sources)
             return 0
         t = env.Command(target='foo.out', source=['foo1.in','foo2.in'],
                         action=testFunc)[0]
-        assert not t.builder is None
+        assert t.builder is not None
         assert t.builder.action.__class__.__name__ == 'FunctionAction'
         t.build()
         assert 'foo1.in' in map(lambda x: x.path, t.sources)
         t = env.Command(target='baz.out', source='baz.in',
                         action='${TEST2(XYZ)}',
                         XYZ='magic word')[0]
-        assert not t.builder is None
+        assert t.builder is not None
         t.build()
         assert x[0] == 'magic word', x
 
                 pass
 
             c = env.Configure()
-            assert not c is None, c
+            assert c is not None, c
             c.Finish()
 
             c = env.Configure(custom_tests = {'foo' : func, '$FOO' : func})
-            assert not c is None, c
+            assert c is not None, c
             assert hasattr(c, 'foo')
             assert hasattr(c, 'xyzzy')
             c.Finish()
         env = self.TestEnvironment(FOO = scan)
 
         s = env.Scanner('foo')
-        assert not s is None, s
+        assert s is not None, s
 
         s = env.Scanner(function = 'foo')
-        assert not s is None, s
+        assert s is not None, s
 
         if 0:
             s = env.Scanner('$FOO')
-            assert not s is None, s
+            assert s is not None, s
 
             s = env.Scanner(function = '$FOO')
-            assert not s is None, s
+            assert s is not None, s
 
     def test_SConsignFile(self):
         """Test the SConsignFile() method"""
 
             env.SConsignFile('foo')
             assert fnames[-1] == os.path.join(os.sep, 'dir', 'foo'), fnames
-            assert dbms[-1] == None, dbms
+            assert dbms[-1] is None, dbms
 
             env.SConsignFile('$FOO')
             assert fnames[-1] == os.path.join(os.sep, 'dir', 'SConsign'), fnames
-            assert dbms[-1] == None, dbms
+            assert dbms[-1] is None, dbms
 
             env.SConsignFile('/$FOO')
             assert fnames[-1] == os.sep + 'SConsign', fnames
-            assert dbms[-1] == None, dbms
+            assert dbms[-1] is None, dbms
 
             env.SConsignFile(os.sep + '$FOO')
             assert fnames[-1] == os.sep + 'SConsign', fnames
-            assert dbms[-1] == None, dbms
+            assert dbms[-1] is None, dbms
 
             env.SConsignFile('$BAR', 'x')
             assert fnames[-1] == os.path.join(os.sep, 'File'), fnames
 
             env.SConsignFile()
             assert fnames[-1] == os.path.join(os.sep, 'dir', '.sconsign'), fnames
-            assert dbms[-1] == None, dbms
+            assert dbms[-1] is None, dbms
 
             env.SConsignFile(None)
-            assert fnames[-1] == None, fnames
-            assert dbms[-1] == None, dbms
+            assert fnames[-1] is None, fnames
+            assert dbms[-1] is None, dbms
         finally:
             SCons.SConsign.File = save_SConsign_File
 
         assert env.get('YYY') == 'y', env.get('YYY')
         assert env2.get('YYY') == 'y', env2.get('YYY')
         assert env3.get('YYY') == 'y3', env3.get('YYY')
-        assert env.get('ZZZ') == None, env.get('ZZZ')
-        assert env2.get('ZZZ') == None, env2.get('ZZZ')
+        assert env.get('ZZZ') is None, env.get('ZZZ')
+        assert env2.get('ZZZ') is None, env2.get('ZZZ')
         assert env3.get('ZZZ') == 'z3', env3.get('ZZZ')
 
     def test_has_key(self):
     def test_is_valid_construction_var(self):
         """Testing is_valid_construction_var()"""
         r = is_valid_construction_var("_a")
-        assert not r is None, r
+        assert r is not None, r
         r = is_valid_construction_var("z_")
-        assert not r is None, r
+        assert r is not None, r
         r = is_valid_construction_var("X_")
-        assert not r is None, r
+        assert r is not None, r
         r = is_valid_construction_var("2a")
         assert r is None, r
         r = is_valid_construction_var("a2_")
-        assert not r is None, r
+        assert r is not None, r
         r = is_valid_construction_var("/")
         assert r is None, r
         r = is_valid_construction_var("_/")

File src/engine/SCons/ErrorsTests.py

View file
  • Ignore whitespace
             assert e.errstr == "Unknown error"
             assert e.status == 2
             assert e.exitstatus == 2
-            assert e.filename == None
+            assert e.filename is None
             assert e.exc_info == (None, None, None)
 
-            assert e.node == None
-            assert e.executor == None
-            assert e.action == None
-            assert e.command == None
+            assert e.node is None
+            assert e.executor is None
+            assert e.action is None
+            assert e.command is None
 
     def test_InternalError(self):
         """Test the InternalError exception."""

File src/engine/SCons/Node/AliasTests.py

View file
  • Ignore whitespace
         """Test creating an Alias name space
         """
         ans = SCons.Node.Alias.AliasNameSpace()
-        assert not ans is None, ans
+        assert ans is not None, ans
 
     def test_ANS_Alias(self):
         """Test the Alias() factory
         assert a is a1, a1
 
         a = ans.lookup('a2')
-        assert a == None, a
+        assert a is None, a
 
     def test_Alias(self):
         """Test creating an Alias() object

File src/engine/SCons/Node/FSTests.py

View file
  • Ignore whitespace
 
         e1 = fs.Entry('e1')
         s = e1.stat()
-        assert not s is None, s
+        assert s is not None, s
 
         e2 = fs.Entry('e2')
         s = e2.stat()
 
         f = fs.File('does_not_exist')
         r = f.remove()
-        assert r == None, r
+        assert r is None, r
 
         test.write('exists', "exists\n")
         f = fs.File('exists')

File src/engine/SCons/Node/NodeTests.py

View file
  • Ignore whitespace
         # Make sure it doesn't blow up if no builder is set.
         node = MyNode("www")
         node.build()
-        assert built_it == None
+        assert built_it is None
         node.build(extra_kw_argument = 1)
-        assert built_it == None
+        assert built_it is None
 
         node = MyNode("xxx")
         node.builder_set(Builder())
         n = SCons.Node.Node()
         t, m = n.alter_targets()
         assert t == [], t
-        assert m == None, m
+        assert m is None, m
 
     def test_is_up_to_date(self):
         """Test the default is_up_to_date() method
         node.fs = FS()
         node.fs.Top = SCons.Node.Node()
         result = node.explain()
-        assert result == None, result
+        assert result is None, result
 
         def get_null_info():
             class Null_SConsignEntry:
 
     def test_scanner_key(self):
         """Test that a scanner_key() method exists"""
-        assert SCons.Node.Node().scanner_key() == None
+        assert SCons.Node.Node().scanner_key() is None
 
     def test_children(self):
         """Test fetching the non-ignored "children" of a Node.
         assert not nw.is_done()
         assert nw.next().name ==  "n1"
         assert nw.is_done()
-        assert nw.next() == None
+        assert nw.next() is None
 
         n2 = MyNode("n2")
         n3 = MyNode("n3")
         n = nw.next()
         assert n.name ==  "n1", n.name
         n = nw.next()
-        assert n == None, n
+        assert n is None, n
 
         n4 = MyNode("n4")
         n5 = MyNode("n5")
         assert nw.next().name ==  "n3"
         assert nw.history.has_key(n1)
         assert nw.next().name ==  "n1"
-        assert nw.next() == None
+        assert nw.next() is None
 
         n8 = MyNode("n8")
         n8.add_dependency([n3])
         n = nw.next()
         assert n.name == "n7", n.name
         n = nw.next()
-        assert nw.next() == None
+        assert nw.next() is None
 
     def test_abspath(self):
         """Test the get_abspath() method."""

File src/engine/SCons/Node/Python.py

View file
  • Ignore whitespace
     def __init__(self, value, built_value=None):
         SCons.Node.Node.__init__(self)
         self.value = value
-        if not built_value is None:
+        if built_value is not None:
             self.built_value = built_value
 
     def str_for_display(self):

File src/engine/SCons/Node/__init__.py

View file
  • Ignore whitespace
             if d.missing():
                 msg = "Explicit dependency `%s' not found, needed by target `%s'."
                 raise SCons.Errors.StopError, msg % (d, self)
-        if not self.implicit is None:
+        if self.implicit is not None:
             for i in self.implicit:
                 if i.missing():
                     msg = "Implicit dependency `%s' not found, needed by target `%s'."
             # There was no explicit builder for this Node, so initialize
             # the self.builder attribute to None now.
             b = self.builder = None
-        return not b is None
+        return b is not None
 
     def set_explicit(self, is_explicit):
         self.is_explicit = is_explicit
         # Don't bother scanning non-derived files, because we don't
         # care what their dependencies are.
         # Don't scan again, if we already have scanned.
-        if not self.implicit is None:
+        if self.implicit is not None:
             return
         self.implicit = []
         self.implicit_set = set()
 
     def add_wkid(self, wkid):
         """Add a node to the list of kids waiting to be evaluated"""
-        if self.wkids != None:
+        if self.wkids is not None:
             self.wkids.append(wkid)
 
     def _children_reset(self):

File src/engine/SCons/Platform/posix.py

View file
  • Ignore whitespace
                 str = cmd_stdout.read()
                 if len(str) == 0:
                     stdout_eof = 1
-                elif stdout != None:
+                elif stdout is not None:
                     stdout.write(str)
             if cmd_stderr in i:
                 str = cmd_stderr.read()

File src/engine/SCons/Platform/win32.py

View file
  • Ignore whitespace
                 ret = exitvalmap[e[0]]
             except KeyError:
                 sys.stderr.write("scons: unknown OSError exception code %d - %s: %s\n" % (e[0], cmd, e[1]))
-            if stderr != None:
+            if stderr is not None:
                 stderr.write("scons: %s: %s\n" % (cmd, e[1]))
         # copy child output from tempfiles to our streams
         # and do clean up stuff
-        if stdout != None and stdoutRedirected == 0:
+        if stdout is not None and stdoutRedirected == 0:
             try:
                 stdout.write(open( tmpFileStdout, "r" ).read())
                 os.remove( tmpFileStdout )
             except (IOError, OSError):
                 pass
 
-        if stderr != None and stderrRedirected == 0:
+        if stderr is not None and stderrRedirected == 0:
             try:
                 stderr.write(open( tmpFileStderr, "r" ).read())
                 os.remove( tmpFileStderr )

File src/engine/SCons/SConf.py

View file
  • Ignore whitespace
         if not SConfFS:
             SConfFS = SCons.Node.FS.default_fs or \
                       SCons.Node.FS.FS(env.fs.pathTop)
-        if not sconf_global is None:
+        if sconf_global is not None:
             raise (SCons.Errors.UserError,
                    "Only one SConf object may be active at one time")
         self.env = env
-        if log_file != None:
+        if log_file is not None:
             log_file = SConfFS.File(env.subst(log_file))
         self.logfile = log_file
         self.logstream = None
         self.AddTests(default_tests)
         self.AddTests(custom_tests)
         self.confdir = SConfFS.Dir(env.subst(conf_dir))
-        if not config_h is None:
+        if config_h is not None:
             config_h = SConfFS.File(config_h)
         self.config_h = config_h
         self._startup()
         Tries to build the given nodes immediately. Returns 1 on success,
         0 on error.
         """
-        if self.logstream != None:
+        if self.logstream is not None:
             # override stdout / stderr to write in log file
             oldStdout = sys.stdout
             sys.stdout = self.logstream
             SConfFS.set_max_drift(save_max_drift)
             os.chdir(old_os_dir)
             SConfFS.chdir(old_fs_dir, change_os_dir=0)
-            if self.logstream != None:
+            if self.logstream is not None:
                 # restore stdout / stderr
                 sys.stdout = oldStdout
                 sys.stderr = oldStderr
             self.env['SPAWN'] = self.pspawn_wrapper
             sourcetext = self.env.Value(text)
 
-            if text != None:
+            if text is not None:
                 textFile = self.confdir.File(f + extension)
                 textFileNode = self.env.SConfSourceBuilder(target=textFile,
                                                            source=sourcetext)
                        "Test called after sconf.Finish()")
             context = CheckContext(self.sconf)
             ret = apply(self.test, (context,) +  args, kw)
-            if not self.sconf.config_h is None:
+            if self.sconf.config_h is not None:
                 self.sconf.config_h_text = self.sconf.config_h_text + context.config_h
             context.Result("error: no result")
             return ret
         self._createDir(self.confdir)
         self.confdir.up().add_ignore( [self.confdir] )
 
-        if self.logfile != None and not dryrun:
+        if self.logfile is not None and not dryrun:
             # truncate logfile, if SConf.Configure is called for the first time
             # in a build
             if _ac_config_logs.has_key(self.logfile):
 
         if not self.active:
             raise SCons.Errors.UserError, "Finish may be called only once!"
-        if self.logstream != None and not dryrun:
+        if self.logstream is not None and not dryrun:
             self.logstream.write("\n")
             self.logstream.close()
             self.logstream = None
         self.Log("scons: Configure: " + msg + "\n")
 
     def Log(self, msg):
-        if self.sconf.logstream != None:
+        if self.sconf.logstream is not None:
             self.sconf.logstream.write(msg)
 
     #### End of stuff used by Conftest.py.

File src/engine/SCons/SConfTests.py

View file
  • Ignore whitespace
         log = self.test.read( self.test.workpath('config.log') )
         expr = re.compile( ".*failed in a previous run and all", re.DOTALL ) 
         firstOcc = expr.match( log )
-        assert firstOcc != None, log
+        assert firstOcc is not None, log
         secondOcc = expr.match( log, firstOcc.end(0) )
-        assert secondOcc == None, log
+        assert secondOcc is None, log
 
         # 2.2 test the error caching mechanism (dependencies have changed)
         self._resetSConfState()
         log = self.test.read( self.test.workpath('config.log') )
         expr = re.compile( ".*failed in a previous run and all", re.DOTALL )
         firstOcc = expr.match( log )
-        assert firstOcc != None, log
+        assert firstOcc is not None, log
         secondOcc = expr.match( log, firstOcc.end(0) )
-        assert secondOcc == None, log
+        assert secondOcc is None, log
 
 
     def test_TryAction(self):

File src/engine/SCons/Scanner/__init__.py

View file
  • Ignore whitespace
     def scan(self, node, path=()):
 
         # cache the includes list in node so we only scan it once:
-        if node.includes != None:
+        if node.includes is not None:
             includes = node.includes
         else:
             includes = self.find_include_names (node)

File src/engine/SCons/Script/Main.py

View file
  • Ignore whitespace
         else:
             node = None
             # Why would ltop be None? Unfortunately this happens.
-            if ltop == None: ltop = ''
+            if ltop is None: ltop = ''
             # Curdir becomes important when SCons is called with -u, -C,
             # or similar option that changes directory, and so the paths
             # of targets given on the command line need to be adjusted.
             curdir = os.path.join(os.getcwd(), str(ltop))
             for lookup in SCons.Node.arg2nodes_lookups:
                 node = lookup(x, curdir=curdir)
-                if node != None:
+                if node is not None:
                     break
             if node is None:
                 node = fs.Entry(x, directory=ltop, create=1)

File src/engine/SCons/TaskmasterTests.py

View file
  • Ignore whitespace
         t.prepare()
         t.execute()
         t = tm.next_task()
-        assert t == None
+        assert t is None
 
         n1 = Node("n1")
         n2 = Node("n2")
         t.executed()
         t.postprocess()
 
-        assert tm.next_task() == None
+        assert tm.next_task() is None
 
         built_text = "up to date: "
         top_node = n3
         t.executed()
         t.postprocess()
 
-        assert tm.next_task() == None
+        assert tm.next_task() is None
 
 
         n1 = Node("n1")
         t5.executed()
         t5.postprocess()
 
-        assert tm.next_task() == None
+        assert tm.next_task() is None
 
 
         n4 = Node("n4")
         n4.set_state(SCons.Node.executed)
         tm = SCons.Taskmaster.Taskmaster([n4])
-        assert tm.next_task() == None
+        assert tm.next_task() is None
 
         n1 = Node("n1")
         n2 = Node("n2", [n1])
         t.executed()
         t.postprocess()
         t = tm.next_task()
-        assert tm.next_task() == None
+        assert tm.next_task() is None
 
 
         n1 = Node("n1")
         assert target == n3, target
         t.executed()
         t.postprocess()
-        assert tm.next_task() == None
+        assert tm.next_task() is None
 
         n1 = Node("n1")
         n2 = Node("n2")
         assert t.get_target() == n4
         t.executed()
         t.postprocess()
-        assert tm.next_task() == None
+        assert tm.next_task() is None
         assert scan_called == 4, scan_called
 
         tm = SCons.Taskmaster.Taskmaster([n5])
         t = tm.next_task()
         assert t.get_target() == n5, t.get_target()
         t.executed()
-        assert tm.next_task() == None
+        assert tm.next_task() is None
         assert scan_called == 5, scan_called
 
         n1 = Node("n1")

File src/engine/SCons/Tool/JavaCommonTests.py

View file
  • Ignore whitespace
 }
 """
         pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
-        assert pkg_dir == None, pkg_dir
+        assert pkg_dir is None, pkg_dir
         assert classes == ['BadDep'], classes
 
 
 """
 
         pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
-        assert pkg_dir == None, pkg_dir
+        assert pkg_dir is None, pkg_dir
         assert classes == ['Test'], classes
 
 
 """
 
         pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
-        assert pkg_dir == None, pkg_dir
+        assert pkg_dir is None, pkg_dir
         assert classes == ['MyTabs$MyInternal', 'MyTabs'], classes
 
 
 """
 
         pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
-        assert pkg_dir == None, pkg_dir
+        assert pkg_dir is None, pkg_dir
         assert classes == ['TestClass$1', 'TestClass$2', 'TestClass'], classes
 
 
 """
 
         pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
-        assert pkg_dir == None, pkg_dir
+        assert pkg_dir is None, pkg_dir
         assert classes == ['TestSCons', 'Foo'], classes
 
 
 """
 
         pkg_dir, classes = SCons.Tool.JavaCommon.parse_java(input)
-        assert pkg_dir == None, pkg_dir
+        assert pkg_dir is None, pkg_dir
         assert classes == ['A$B', 'A'], classes
 
     def test_anonymous_classes_with_parentheses(self):

File src/engine/SCons/Tool/tex.py

View file
  • Ignore whitespace
         print " scanning ",str(theFile)
 
     for i in range(len(file_tests_search)):
-        if file_tests[i][0] == None:
+        if file_tests[i][0] is None:
             file_tests[i][0] = file_tests_search[i].search(content)
 
     # recursively call this on each of the included files
 
     for src in inc_files:
         srcNode = srcNode = FindFile(src,['.tex','.ltx','.latex'],paths,env,requireExt=False)
-        if srcNode != None:
+        if srcNode is not None:
             file_test = ScanFiles(srcNode, target, paths, file_tests, file_tests_search, env, graphics_extensions, targetdir)
     if Verbose:
         print " done scanning ",str(theFile)

File src/engine/SCons/Util.py

View file
  • Ignore whitespace
             # the dictionary before giving up.
             s_dict = {}
             for (k,v) in self.items():
-                if not k is None:
+                if k is not None:
                     s_k = env.subst(k)
                     if s_dict.has_key(s_k):
                         # We only raise an error when variables point

File src/engine/SCons/UtilTests.py

View file
  • Ignore whitespace
 
         s = Selector({'.d' : 'DDD', '.e' : 'EEE'})
         ret = s(env, [])
-        assert ret == None, ret
+        assert ret is None, ret
         ret = s(env, [MyNode('foo.d')])
         assert ret == 'DDD', ret
         ret = s(env, [MyNode('bar.e')])
         assert ret == 'EEE', ret
         ret = s(env, [MyNode('bar.x')])
-        assert ret == None, ret
+        assert ret is None, ret
         s[None] = 'XXX'
         ret = s(env, [MyNode('bar.x')])
         assert ret == 'XXX', ret

File src/engine/SCons/Variables/BoolVariableTests.py

View file
  • Ignore whitespace
         assert o.key == 'test', o.key
         assert o.help == 'test option help (yes|no)', o.help
         assert o.default == 0, o.default
-        assert not o.validator is None, o.validator
-        assert not o.converter is None, o.converter
+        assert o.validator is not None, o.validator
+        assert o.converter is not None, o.converter
 
     def test_converter(self):
         """Test the BoolVariable converter"""

File src/engine/SCons/Variables/EnumVariableTests.py

View file
  • Ignore whitespace
         assert o.key == 'test', o.key
         assert o.help == 'test option help (one|two|three)', o.help
         assert o.default == 0, o.default
-        assert not o.validator is None, o.validator
-        assert not o.converter is None, o.converter
+        assert o.validator is not None, o.validator
+        assert o.converter is not None, o.converter
 
     def test_converter(self):
         """Test the EnumVariable converter"""

File src/engine/SCons/Variables/PackageVariableTests.py

View file
  • Ignore whitespace
         assert o.key == 'test', o.key
         assert o.help == 'test option help\n    ( yes | no | /path/to/test )', repr(o.help)
         assert o.default == '/default/path', o.default
-        assert not o.validator is None, o.validator
-        assert not o.converter is None, o.converter
+        assert o.validator is not None, o.validator
+        assert o.converter is not None, o.converter
 
     def test_converter(self):
         """Test the PackageVariable converter"""

File src/engine/SCons/Variables/PathVariableTests.py

View file
  • Ignore whitespace
         assert o.key == 'test', o.key
         assert o.help == 'test option help ( /path/to/test )', repr(o.help)
         assert o.default == '/default/path', o.default
-        assert not o.validator is None, o.validator
+        assert o.validator is not None, o.validator
         assert o.converter is None, o.converter
 
     def test_PathExists(self):

File src/engine/SCons/Variables/VariablesTests.py

View file
  • Ignore whitespace
         o = opts.options[0]
         assert o.key == 'VAR'
         assert o.help == ''
-        assert o.default == None
-        assert o.validator == None
-        assert o.converter == None
+        assert o.default is None
+        assert o.validator is None
+        assert o.converter is None
 
         o = opts.options[1]
         assert o.key == 'ANSWER'
         o = opts.options[0]
         assert o.key == 'VAR2', o.key
         assert o.help == '', o.help
-        assert o.default == None, o.default
-        assert o.validator == None, o.validator
-        assert o.converter == None, o.converter
+        assert o.default is None, o.default
+        assert o.validator is None, o.validator
+        assert o.converter is None, o.converter
 
         o = opts.options[1]
         assert o.key == 'ANSWER2', o.key

File src/script/scons-time.py

View file
  • Ignore whitespace
         lines = open(file).readlines()
         line = [ l for l in lines if l.endswith(object_string) ][0]
         result = [ int(field) for field in line.split()[:4] ]
-        if not index is None:
+        if index is not None:
             result = result[index]
         return result
 

File src/test_interrupts.py

View file
  • Ignore whitespace
                 exc_all_seen = 0
                 line = l
                 #print " -> reset"
-            elif not m1 is None:
+            elif m1 is not None:
                 exc_keyboardint_seen = 1
                 #print " -> keyboard -> ", m1.groups()
-            elif not m2 is None:
+            elif m2 is not None:
                 exc_all_seen = 1
                 #print " -> all -> ", m2.groups()
             else: