comparison test/mocknull.py @ 5404:3757449e00c4

Python 3 preparation: use __bool__ instead of __nonzero__. Tool-assisted patch. __nonzero__ = __bool__ included for Python 2 compatibility.
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 23:50:25 +0000
parents 79fd8537ae3b
children a35d4cc8cd1a
comparison
equal deleted inserted replaced
5403:7f6afc7477e8 5404:3757449e00c4
14 # client.db.config.TRACKER_WEB = 'BASE/' 14 # client.db.config.TRACKER_WEB = 'BASE/'
15 self.__dict__[name] = MockNull() 15 self.__dict__[name] = MockNull()
16 return getattr(self, name) 16 return getattr(self, name)
17 17
18 def __getitem__(self, key): return self 18 def __getitem__(self, key): return self
19 def __nonzero__(self): return 0 19 def __bool__(self): return 0
20 # Python 2 compatibility:
21 __nonzero__ = __bool__
20 def __str__(self): return '' 22 def __str__(self): return ''
21 def __repr__(self): return '<MockNull 0x%x>'%id(self) 23 def __repr__(self): return '<MockNull 0x%x>'%id(self)
22 def gettext(self, str): return str 24 def gettext(self, str): return str
23 _ = gettext 25 _ = gettext

Roundup Issue Tracker: http://roundup-tracker.org/