diff options
author | Guido van Rossum <guido@python.org> | 1997-08-05 16:52:50 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-08-05 16:52:50 (GMT) |
commit | 570278be6ea5e3981d20f9ffcfeec27d43cf9770 (patch) | |
tree | 5179edb006e73cc8e0c8d9b2e5b2afe6cbc19136 /Lib/test/test_opcodes.py | |
parent | 83f9ad8399a7b199263ea1522a8d599d6dea6eb0 (diff) | |
download | cpython-570278be6ea5e3981d20f9ffcfeec27d43cf9770.zip cpython-570278be6ea5e3981d20f9ffcfeec27d43cf9770.tar.gz cpython-570278be6ea5e3981d20f9ffcfeec27d43cf9770.tar.bz2 |
Add test for function comparisons
Diffstat (limited to 'Lib/test/test_opcodes.py')
-rw-r--r-- | Lib/test/test_opcodes.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Lib/test/test_opcodes.py b/Lib/test/test_opcodes.py index b1e944b..656e00a 100644 --- a/Lib/test/test_opcodes.py +++ b/Lib/test/test_opcodes.py @@ -57,3 +57,38 @@ except AClass, v: try: raise BClass, a except TypeError: pass + + +print '2.3 comparing function objects' + +f = eval('lambda: None') +g = eval('lambda: None') +if f != g: raise TestFailed + +f = eval('lambda a: a') +g = eval('lambda a: a') +if f != g: raise TestFailed + +f = eval('lambda a=1: a') +g = eval('lambda a=1: a') +if f != g: raise TestFailed + +f = eval('lambda: 0') +g = eval('lambda: 1') +if f == g: raise TestFailed + +f = eval('lambda: None') +g = eval('lambda a: None') +if f == g: raise TestFailed + +f = eval('lambda a: None') +g = eval('lambda b: None') +if f == g: raise TestFailed + +f = eval('lambda a: None') +g = eval('lambda a=None: None') +if f == g: raise TestFailed + +f = eval('lambda a=0: None') +g = eval('lambda a=1: None') +if f == g: raise TestFailed |