Changeset View
Changeset View
Standalone View
Standalone View
autotests/input/test.py
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 38 | def test_f_literals(): | |||
---|---|---|---|---|---|
43 | 43 | | |||
44 | f'x{bar["baz"]!r}y\n' | 44 | f'x{bar["baz"]!r}y\n' | ||
45 | f'x{bar["baz"]:.2}y\n' | 45 | f'x{bar["baz"]:.2}y\n' | ||
46 | 46 | | |||
47 | a = "Escapes in String \U12345678 \xAB \"" | 47 | a = "Escapes in String \U12345678 \xAB \"" | ||
48 | "Escapes in Doc/Comment String \u1234 \xAb \"\\" | 48 | "Escapes in Doc/Comment String \u1234 \xAb \"\\" | ||
49 | ''' Doc/Comment String \N{123} \'''' | 49 | ''' Doc/Comment String \N{123} \'''' | ||
50 | """ Doc/Comment String \17 \x1f \n \" \\""" | 50 | """ Doc/Comment String \17 \x1f \n \" \\""" | ||
51 | | ||||
52 | # Decimal, Hex, Binary, Octal | ||||
53 | a = 1_2_34L | ||||
54 | b = 0_0_00_0 | ||||
55 | c = 0xA_3f_43D | ||||
56 | d = 0b0_0_1_01 | ||||
57 | e = 0o71_2_34 | ||||
58 | # Float | ||||
59 | d = 1.1E+3 | ||||
60 | e = 1.E+3 | ||||
61 | f = .1E+3 | ||||
62 | g = 1E+3 | ||||
63 | h = 1.1 | ||||
64 | i = 1. | ||||
65 | j = .1 | ||||
66 | k = 1 | ||||
67 | l = 1_0.e+3_22 + .2_1e2 + 11_1. | ||||
68 | # Complex | ||||
69 | m = 1.1E+3j | ||||
70 | n = 1.E+3j | ||||
71 | o = .1E+3j | ||||
72 | p = 1E+3j | ||||
73 | q = 1.1j | ||||
74 | r = 1.j | ||||
75 | s = .1j | ||||
76 | t = 1j | ||||
77 | u = 1_0.e+3_22j + .2_1e2j + 11_1.j | ||||
78 | | ||||
79 | # Invalid numbers | ||||
80 | aaa.123 | ||||
81 | aaa123 | ||||
82 | .0x123 |