blob: 6776b51de7a137ac951f0cea9397c0a26d4e8177 (
plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# coding: utf-8
from __future__ import print_function, absolute_import, division, unicode_literals
import pytest # NOQA
from roundtrip import round_trip, dedent, round_trip_load, round_trip_dump
class TestBinHexOct:
# @pytest.mark.xfail(strict=True)
def test_round_trip_hex_oct(self):
round_trip("""\
- 42
- 0b101010
- 0x2a
- 0x2A
- 0o52
""")
def test_calculate(self):
s = dedent("""\
- 42
- 0b101010
- 0x2a
- 0x2A
- 0o52
""")
x = round_trip_load(s)
for idx, elem in enumerate(x):
# x[idx] = type(elem)(elem - 21)
elem -= 21
x[idx] = elem
for idx, elem in enumerate(x):
# x[idx] = type(elem)(2 * elem)
elem *= 2
x[idx] = elem
for idx, elem in enumerate(x):
t = elem
elem **= 2
elem //= t
x[idx] = elem
assert round_trip_dump(x) == s
|