Skip to content

Commit

Permalink
Merge remote-tracking branch 'zmsdev/python3' into python3
Browse files Browse the repository at this point in the history
  • Loading branch information
rbu committed May 16, 2018
2 parents 7021cb9 + 02242c2 commit da4d051
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions src/Products/Transience/Transience.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def __setitem__(self, k, v):
length = self._length() # XXX ReadConflictError hotspot

if self._limit and length >= self._limit:
LOG.warn('Transient object container %s max subobjects '
LOG.warning('Transient object container %s max subobjects '
'reached' % self.getId())

raise MaxTransientObjectsExceeded(
Expand Down Expand Up @@ -703,7 +703,7 @@ def _do_replentish_work(self, now, max_ts):
DEBUG and TLOG('_do_replentish_work: replentish_end = %s'
% replentish_end)
# n is the number of buckets to create
n = (replentish_end - replentish_start) / self._period
n = (replentish_end - replentish_start) // self._period
new_buckets = getTimeslices(replentish_start, n, self._period)
new_buckets.reverse()
STRICT and _assert(new_buckets)
Expand Down Expand Up @@ -797,7 +797,7 @@ def _getCallback(self, callback):
except (KeyError, AttributeError):
path = self.getPhysicalPath()
err = 'No such onAdd/onDelete method %s referenced via %s'
LOG.warn(err % (callback, '/'.join(path)),
LOG.warning(err % (callback, '/'.join(path)),
exc_info=sys.exc_info())
return
else:
Expand All @@ -815,15 +815,15 @@ def _notify(self, item, callback, name):
except:
# dont raise, just log
path = self.getPhysicalPath()
LOG.warn('%s failed when calling %s in %s' % (name,callback,
LOG.warning('%s failed when calling %s in %s' % (name,callback,
'/'.join(path)),
exc_info=sys.exc_info())
finally:
setSecurityManager(sm)
else:
err = '%s in %s attempted to call non-callable %s'
path = self.getPhysicalPath()
LOG.warn(err % (name, '/'.join(path), callback),
LOG.warning(err % (name, '/'.join(path), callback),
exc_info=sys.exc_info())

def getId(self):
Expand Down
6 changes: 3 additions & 3 deletions src/Products/Transience/tests/testTimeoutRelated.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def testLastAccessed(self):
# to get to the next Windows time.time() tick.
fauxtime.sleep(WRITEGRANULARITY + 0.06 * 60)
sdo = self.app.sm.get('TempObject')
self.assert_(sdo.getLastAccessed() > la1)
self.assertTrue(sdo.getLastAccessed() > la1)

class TestNotifications(TestBase):
def testAddNotification(self):
Expand All @@ -91,7 +91,7 @@ def testAddNotification(self):
now = fauxtime.time()
k = sdo.get('starttime')
self.assertEqual(type(k), type(now))
self.assert_(k <= now)
self.assertTrue(k <= now)

def testDelNotification(self):
self.app.sm.setDelNotificationTarget(delNotificationTarget)
Expand All @@ -102,7 +102,7 @@ def testDelNotification(self):
now = fauxtime.time()
k = sdo.get('endtime')
self.assertEqual(type(k), type(now))
self.assert_(k <= now)
self.assertTrue(k <= now)

def testMissingCallbackGetCallbackReturnsNone(self):
# in response to http://zope.org/Collectors/Zope/1403
Expand Down
20 changes: 10 additions & 10 deletions src/Products/Transience/tests/testTransientObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ def test_id(self):

def test_validate(self):
t = self.t.new('xyzzy')
self.assert_(t.isValid())
self.assertTrue(t.isValid())
t.invalidate()
self.assertFalse(t.isValid())

def test_getLastAccessed(self):
t = self.t.new('xyzzy')
ft = fauxtime.time()
self.assert_(t.getLastAccessed() <= ft)
self.assertTrue(t.getLastAccessed() <= ft)

def test_getCreated(self):
t = self.t.new('xyzzy')
ft = fauxtime.time()
self.assert_(t.getCreated() <= ft)
self.assertTrue(t.getCreated() <= ft)

def test_getLastModifiedUnset(self):
t = self.t.new('xyzzy')
Expand All @@ -73,13 +73,13 @@ def testSetLastModified(self):
def test_setLastAccessed(self):
t = self.t.new('xyzzy')
ft = fauxtime.time()
self.assert_(t.getLastAccessed() <= ft)
self.assertTrue(t.getLastAccessed() <= ft)
fauxtime.sleep(self.timeout * 2) # go to sleep past the granularity
ft2 = fauxtime.time()
t.setLastAccessed()
ft3 = fauxtime.time()
self.assert_(t.getLastAccessed() <= ft3)
self.assert_(t.getLastAccessed() >= ft2)
self.assertTrue(t.getLastAccessed() <= ft3)
self.assertTrue(t.getLastAccessed() >= ft2)

def _genKeyError(self, t):
return t.get('foobie')
Expand All @@ -90,15 +90,15 @@ def _genLenError(self, t):
def test_dictionaryLike(self):
t = self.t.new('keytest')
t.update(data)
self.assertItemsEqual(t.keys(), data.keys())
self.assertItemsEqual(t.values(), data.values())
self.assertItemsEqual(t.items(), data.items())
self.assertCountEqual(t.keys(), data.keys())
self.assertCountEqual(t.values(), data.values())
self.assertCountEqual(t.items(), data.items())
for k in data.keys():
self.assertEqual(t.get(k), data.get(k))
self.assertEqual(t.get('foobie'), None)
self.assertRaises(AttributeError, self._genLenError, t)
self.assertEqual(t.get('foobie',None), None)
self.assert_(t.has_key('a'))
self.assertTrue(t.has_key('a'))
self.assertFalse(t.has_key('foobie'))
t.clear()
self.assertEqual(len(t.keys()), 0)
Expand Down
14 changes: 7 additions & 7 deletions src/Products/Transience/tests/testTransientObjectContainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def testItemsWorks(self):
self.t[x] = x
v = self.t.items()
v.sort()
self.assertEquals(len(v), 100)
self.assertEqual(len(v), 100)
i = 10
for x in v:
self.assertEqual(x[0], i)
Expand Down Expand Up @@ -173,21 +173,21 @@ def testTargetedDeletes(self):
self.assertEqual(self.t.keys(), [])

def testPathologicalRightBranching(self):
r = range(10, 1010)
r = list(range(10, 1010))
for x in r:
self.t[x] = 1
assert list(self.t.keys()) == r, (self.t.keys(), r)
map(self.t.__delitem__, r)
self.assertEqual(list(self.t.keys()), r)
[self.t.__delitem__(x) for x in r]
self.assertEqual(list(self.t.keys()), [])

def testPathologicalLeftBranching(self):
r = range(10, 1010)
r = list(range(10, 1010))
revr = r[:]
revr.reverse()
for x in revr:
self.t[x] = 1
self.assertEqual(list(self.t.keys()), r)
map(self.t.__delitem__, revr)
[self.t.__delitem__(x) for x in revr]
self.assertEqual(list(self.t.keys()), [])

def testSuccessorChildParentRewriteExerciseCase(self):
Expand Down Expand Up @@ -334,7 +334,7 @@ def testGarbageCollection(self):
max_ts = self.t._last_finalized_timeslice()
keys = list(self.t._data.keys())
for k in keys:
self.assert_(k > max_ts, "k %s < max_ts %s" % (k, max_ts))
self.assertTrue(k > max_ts, "k %s < max_ts %s" % (k, max_ts))

def _maxOut(self):
for x in range(11):
Expand Down

0 comments on commit da4d051

Please sign in to comment.