sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Comparison methods missing in the None object ( #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
m = None
assert not m >= 0
assert not m > 0
assert m <= 0
assert m < 0
assert m != 0
assert m <> 0
print('Ok')

What is the expected output? What do you see instead?
Ok

Instead :

RuntimeError: TypeError: m.__ge__ is not a function
module '__main__' line 3
assert not m >= 0

After commenting line 3 to 7
RuntimeError: TypeError: m.__gt__ is not a function
RuntimeError: TypeError: m.__le__ is not a function
RuntimeError: TypeError: m.__lt__ is not a function
RuntimeError: TypeError: m.__ne__ is not a function

Should be __ne__, refer to issue 102
RuntimeError: TypeError: m.__lt__ is not a function 

What version of the product are you using? On what operating system?
Brython version 1.1.20130309-192522
Linux Mint 12 - Firefox 19.0

Please provide any additional information below.

Original issue reported on code.google.com by ca...@nce.ufrj.br on 15 Mar 2013 at 12:36

GoogleCodeExporter commented 9 years ago
FYI..  python 3.3 produces the following for the above tests...

 m = None
>>> assert not m >= 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() >= int()
>>> assert not m > 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() > int()
>>> assert m <= 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() <= int()
>>> assert m < 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() < int()
>>> assert m != 0
>>> assert m <> 0
  File "<stdin>", line 1
    assert m <> 0
              ^
SyntaxError: invalid syntax

I should be able to easily add the TypeError messages, etc, but the <> issue 
(related to issue # 102) may need to wait till Pierre can take a peak.

Thanks!

Billy

Original comment by billy.earney@gmail.com on 17 Mar 2013 at 2:33

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r725.

Original comment by billy.earney@gmail.com on 17 Mar 2013 at 8:22