File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 119119- Python 3.10 support
120120- pytest
121121- black code style
122+
123+ ### 2.3
124+
125+ 2022-09-01
126+
127+ ### Fix
128+
129+ - Fix compare with None
Original file line number Diff line number Diff line change 2626
2727__author__ = 'Andrea Bonomi <andrea.bonomi@gmail.com>'
2828__license__ = 'MIT'
29- __version__ = '2.2 '
29+ __version__ = '2.3 '
3030__date__ = '15 August 2013'
3131
3232import struct
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ def size(self) -> int:
141141 return self .__size__
142142
143143 def __eq__ (self , other : Any ) -> bool :
144- return isinstance (other , self .__class__ ) and self .__dict__ == other .__dict__
144+ return other is not None and isinstance (other , self .__class__ ) and self .__dict__ == other .__dict__
145145
146146 def __ne__ (self , other : Any ) -> bool :
147147 return not self .__eq__ (other )
Original file line number Diff line number Diff line change @@ -246,3 +246,9 @@ def test_nested():
246246 assert flat .endAddrCylSec == nested .end .addrCylSec
247247 assert flat .startLBA == nested .startLBA
248248 assert flat .endLBA == nested .endLBA
249+
250+
251+ def test_null_compare ():
252+ c = Dummy ()
253+ assert c is not None
254+ assert c != None
Original file line number Diff line number Diff line change @@ -243,3 +243,9 @@ def test_nested():
243243 assert flat .endAddrCylSec == nested .end .addrCylSec
244244 assert flat .startLBA == nested .startLBA
245245 assert flat .endLBA == nested .endLBA
246+
247+
248+ def test_null_compare ():
249+ c = Dummy ()
250+ assert c is not None
251+ assert c != None
You can’t perform that action at this time.
0 commit comments