File: test_bit_wise_operators.py

package info (click to toggle)
restrictedpython 8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,072 kB
  • sloc: python: 4,043; makefile: 193
file content (25 lines) | stat: -rw-r--r-- 415 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from tests.helper import restricted_eval


def test_BitAnd():
    assert restricted_eval('5 & 3') == 1


def test_BitOr():
    assert restricted_eval('5 | 3') == 7


def test_BitXor():
    assert restricted_eval('5 ^ 3') == 6


def test_Invert():
    assert restricted_eval('~17') == -18


def test_LShift():
    assert restricted_eval('8 << 2') == 32


def test_RShift():
    assert restricted_eval('8 >> 1') == 4