diff options
| author | Ashley Whetter <AWhetter@users.noreply.github.com> | 2019-10-15 01:49:26 -0700 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-10-15 10:49:26 +0200 |
| commit | 2f288598de485c6af25788fc917139b48c31c474 (patch) | |
| tree | 3b52b2994c90018a2db2854adca0928c4bfe1162 /tests/testdata/python3/data/operator_precedence.py | |
| parent | 73babe3d536ffc4da94e59c705eb6a8c3e5822ef (diff) | |
| download | astroid-git-2f288598de485c6af25788fc917139b48c31c474.tar.gz | |
Moved tests out of package directory (#704)
Diffstat (limited to 'tests/testdata/python3/data/operator_precedence.py')
| -rw-r--r-- | tests/testdata/python3/data/operator_precedence.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/testdata/python3/data/operator_precedence.py b/tests/testdata/python3/data/operator_precedence.py new file mode 100644 index 00000000..b4333375 --- /dev/null +++ b/tests/testdata/python3/data/operator_precedence.py @@ -0,0 +1,27 @@ +assert not not True == True +assert (not False or True) == True +assert True or False and True +assert (True or False) and True + +assert True is not (False is True) == False +assert True is (not False is True == False) + +assert 1 + 2 + 3 == 6 +assert 5 - 4 + 3 == 4 +assert 4 - 5 - 6 == -7 +assert 7 - (8 - 9) == 8 +assert 2**3**4 == 2**81 +assert (2**3)**4 == 8**4 + +assert 1 + 2 if (0.5 if True else 0.2) else 1 if True else 2 == 3 +assert (0 if True else 1) if False else 2 == 2 +assert lambda x: x if (0 if False else 0) else 0 if False else 0 +assert (lambda x: x) if (0 if True else 0.2) else 1 if True else 2 + +assert ('1' + '2').replace('1', '3') == '32' +assert (lambda x: x)(1) == 1 +assert ([0] + [1])[1] == 1 +assert (lambda x: lambda: x + 1)(2)() == 3 + +f = lambda x, y, z: y(x, z) +assert f(1, lambda x, y: x + y[1], (2, 3)) == 4 |
