tests/basics: Use str.format instead of % for formatting messages.
Only use % formatting when testing % itself, because only str.format is guaranteed to be available on any port.
This commit is contained in:
parent
4847460232
commit
709136e844
@ -11,7 +11,7 @@ else:
|
||||
@coroutine
|
||||
def wait(value):
|
||||
print('wait value:', value)
|
||||
msg = yield 'message from wait(%u)' % value
|
||||
msg = yield 'message from wait({})'.format(value)
|
||||
print('wait got back:', msg)
|
||||
return 10
|
||||
|
||||
|
@ -10,7 +10,7 @@ class A:
|
||||
return A(self.v + o.v)
|
||||
|
||||
def __repr__(self):
|
||||
return "A(%s)" % self.v
|
||||
return "A({})".format(self.v)
|
||||
|
||||
a = A(5)
|
||||
b = a
|
||||
@ -37,7 +37,7 @@ class L:
|
||||
return self
|
||||
|
||||
def __repr__(self):
|
||||
return "L(%s)" % self.v
|
||||
return "L({})".format(self.v)
|
||||
|
||||
c = L([1, 2])
|
||||
d = c
|
||||
|
@ -11,7 +11,7 @@ class C:
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return "C(%s)" % self.value
|
||||
return "C({})".format(self.value)
|
||||
|
||||
def __add__(self, rhs):
|
||||
print(self, '+', rhs)
|
||||
|
@ -12,7 +12,7 @@ class A:
|
||||
return A(self.v + o)
|
||||
|
||||
def __repr__(self):
|
||||
return "A(%s)" % self.v
|
||||
return "A({})".format(self.v)
|
||||
|
||||
print(A(3) + 1)
|
||||
print(2 + A(5))
|
||||
|
@ -1,4 +1,4 @@
|
||||
# anything above 0xa0 is printed as Unicode by CPython
|
||||
# the abobe is CPython implementation detail, stick to ASCII
|
||||
for c in range(0x80):
|
||||
print("0x%02x: %s" % (c, repr(chr(c))))
|
||||
print("0x{:02x}: {}".format(c, repr(chr(c))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user