Commit 158206e0 authored by Manuel Franceschini's avatar Manuel Franceschini
Browse files

User assertFalse instead of assert_(not ...)


Signed-off-by: default avatarManuel Franceschini <livewire@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 0fbd4b02
......@@ -91,7 +91,7 @@ class TestSingleFileEventHandler(testutils.GanetiTestCase):
utils.WriteFile(self.chk_files[self.NOTIFIER_TERM], data="dummy")
self.mainloop.Run()
self.assert_(self.notified[self.NOTIFIER_TERM])
self.assert_(not self.notified[self.NOTIFIER_NORM])
self.assertFalse(self.notified[self.NOTIFIER_NORM])
self.assertEquals(self.notifiers[self.NOTIFIER_TERM].error_count, 0)
self.assertEquals(self.notifiers[self.NOTIFIER_NORM].error_count, 0)
......@@ -105,7 +105,7 @@ class TestSingleFileEventHandler(testutils.GanetiTestCase):
utils.WriteFile(self.chk_files[self.NOTIFIER_TERM], data="dummy")
self.mainloop.Run()
self.assert_(self.notified[self.NOTIFIER_TERM])
self.assert_(not self.notified[self.NOTIFIER_NORM])
self.assertFalse(self.notified[self.NOTIFIER_NORM])
self.assertEquals(self.notifiers[self.NOTIFIER_TERM].error_count, 0)
self.assertEquals(self.notifiers[self.NOTIFIER_NORM].error_count, 0)
......@@ -115,7 +115,7 @@ class TestSingleFileEventHandler(testutils.GanetiTestCase):
utils.WriteFile(self.chk_files[self.NOTIFIER_TERM], data="dummy")
self.mainloop.Run()
self.assert_(self.notified[self.NOTIFIER_TERM])
self.assert_(not self.notified[self.NOTIFIER_NORM])
self.assertFalse(self.notified[self.NOTIFIER_NORM])
self.assertEquals(self.notifiers[self.NOTIFIER_TERM].error_count, 0)
self.assertEquals(self.notifiers[self.NOTIFIER_NORM].error_count, 0)
......@@ -125,7 +125,7 @@ class TestSingleFileEventHandler(testutils.GanetiTestCase):
self.mainloop.Run()
self.assert_(self.notified[self.NOTIFIER_TERM])
# NORM notifier is disabled by default
self.assert_(not self.notified[self.NOTIFIER_NORM])
self.assertFalse(self.notified[self.NOTIFIER_NORM])
self.assertEquals(self.notifiers[self.NOTIFIER_TERM].error_count, 0)
self.assertEquals(self.notifiers[self.NOTIFIER_NORM].error_count, 0)
......
......@@ -90,7 +90,7 @@ class _ConditionTestCase(_ThreadedTestCase):
self.cond = cls(self.lock)
def _testAcquireRelease(self):
self.assert_(not self.cond._is_owned())
self.assertFalse(self.cond._is_owned())
self.assertRaises(RuntimeError, self.cond.wait)
self.assertRaises(RuntimeError, self.cond.notifyAll)
......@@ -100,7 +100,7 @@ class _ConditionTestCase(_ThreadedTestCase):
self.assert_(self.cond._is_owned())
self.cond.release()
self.assert_(not self.cond._is_owned())
self.assertFalse(self.cond._is_owned())
self.assertRaises(RuntimeError, self.cond.wait)
self.assertRaises(RuntimeError, self.cond.notifyAll)
......@@ -122,7 +122,7 @@ class _ConditionTestCase(_ThreadedTestCase):
self.assertEqual(self.done.get(True, 1), "NN")
self.assert_(self.cond._is_owned())
self.cond.release()
self.assert_(not self.cond._is_owned())
self.assertFalse(self.cond._is_owned())
class TestSingleNotifyPipeCondition(_ConditionTestCase):
......@@ -259,25 +259,25 @@ class TestSharedLock(_ThreadedTestCase):
self.sl = locking.SharedLock()
def testSequenceAndOwnership(self):
self.assert_(not self.sl._is_owned())
self.assertFalse(self.sl._is_owned())
self.sl.acquire(shared=1)
self.assert_(self.sl._is_owned())
self.assert_(self.sl._is_owned(shared=1))
self.assert_(not self.sl._is_owned(shared=0))
self.assertFalse(self.sl._is_owned(shared=0))
self.sl.release()
self.assert_(not self.sl._is_owned())
self.assertFalse(self.sl._is_owned())
self.sl.acquire()
self.assert_(self.sl._is_owned())
self.assert_(not self.sl._is_owned(shared=1))
self.assertFalse(self.sl._is_owned(shared=1))
self.assert_(self.sl._is_owned(shared=0))
self.sl.release()
self.assert_(not self.sl._is_owned())
self.assertFalse(self.sl._is_owned())
self.sl.acquire(shared=1)
self.assert_(self.sl._is_owned())
self.assert_(self.sl._is_owned(shared=1))
self.assert_(not self.sl._is_owned(shared=0))
self.assertFalse(self.sl._is_owned(shared=0))
self.sl.release()
self.assert_(not self.sl._is_owned())
self.assertFalse(self.sl._is_owned())
def testBooleanValue(self):
# semaphores are supposed to return a true value on a successful acquire
......@@ -747,9 +747,9 @@ class TestSSynchronizedDecorator(_ThreadedTestCase):
def testDecoratedFunctions(self):
self._doItExclusive()
self.assert_(not _decoratorlock._is_owned())
self.assertFalse(_decoratorlock._is_owned())
self._doItSharer()
self.assert_(not _decoratorlock._is_owned())
self.assertFalse(_decoratorlock._is_owned())
def testSharersCanCoexist(self):
_decoratorlock.acquire(shared=1)
......@@ -1026,8 +1026,8 @@ class TestLockSet(_ThreadedTestCase):
self.ls.release()
else:
self.assert_(acquired is None)
self.assert_(not self.ls._list_owned())
self.assert_(not self.ls._is_owned())
self.assertFalse(self.ls._list_owned())
self.assertFalse(self.ls._is_owned())
self.done.put("not acquired")
self._addThread(target=_AcquireOne)
......@@ -1099,7 +1099,7 @@ class TestLockSet(_ThreadedTestCase):
self.ls.release(names=name)
self.assert_(not self.ls._list_owned())
self.assertFalse(self.ls._list_owned())
self._waitThreads()
......
......@@ -75,8 +75,8 @@ class TestIsProcessAlive(unittest.TestCase):
elif pid_non_existing < 0:
raise SystemError("can't fork")
os.waitpid(pid_non_existing, 0)
self.assert_(not IsProcessAlive(pid_non_existing),
"nonexisting process detected")
self.assertFalse(IsProcessAlive(pid_non_existing),
"nonexisting process detected")
class TestGetProcStatusPath(unittest.TestCase):
......@@ -1667,7 +1667,7 @@ class TestIsNormAbsPath(unittest.TestCase):
self.assert_(IsNormAbsPath(path),
"Path %s should result absolute and normalized" % path)
else:
self.assert_(not IsNormAbsPath(path),
self.assertFalse(IsNormAbsPath(path),
"Path %s should not result absolute and normalized" % path)
def testBase(self):
......@@ -2064,7 +2064,7 @@ class TestMakedirs(unittest.TestCase):
def testRecursiveExisting(self):
path = utils.PathJoin(self.tmpdir, "B/moo/xyz")
self.assert_(not os.path.exists(path))
self.assertFalse(os.path.exists(path))
os.mkdir(utils.PathJoin(self.tmpdir, "B"))
utils.Makedirs(path)
self.assert_(os.path.isdir(path))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment