Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 0c9996c

Browse files
committed
Fixed triple-single-quotes to triple-double-quotes when assign contract code
1 parent 7adb2e1 commit 0c9996c

File tree

3 files changed

+56
-72
lines changed

3 files changed

+56
-72
lines changed

ethereum/tests/test_contracts.py

Lines changed: 41 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313

1414
# Test EVM contracts
15-
serpent_code = '''
15+
serpent_code = """
1616
def main(a,b):
1717
return(a ^ b)
18-
'''
18+
"""
1919

2020

2121
def test_evm():
@@ -31,8 +31,7 @@ def test_evm():
3131

3232
# Test serpent compilation of variables using _with_, doing a simple
3333
# arithmetic calculation 20 * 30 + 10 = 610
34-
sixten_code =\
35-
'''
34+
sixten_code = """
3635
(with 'x 10
3736
(with 'y 20
3837
(with 'z 30
@@ -43,7 +42,7 @@ def test_evm():
4342
)
4443
)
4544
)
46-
'''
45+
"""
4746

4847

4948
def test_sixten():
@@ -54,8 +53,7 @@ def test_sixten():
5453
assert utils.big_endian_to_int(o1) == 610
5554

5655

57-
with_code = \
58-
"""
56+
with_code = """
5957
def f1():
6058
o = array(4)
6159
with x = 5:
@@ -103,23 +101,21 @@ def test_with():
103101

104102
# Test Serpent's import mechanism
105103

106-
mul2_code = \
107-
'''
104+
mul2_code = """
108105
def double(v):
109106
log(v)
110107
return(v*2)
111-
'''
108+
"""
112109

113110
filename = "mul2_qwertyuioplkjhgfdsa.se"
114111

115-
returnten_code = \
116-
'''
112+
returnten_code = """
117113
extern mul2: [double:i]
118114
119115
x = create("%s")
120116
log(x)
121117
return(x.double(5))
122-
''' % filename
118+
""" % filename
123119

124120

125121
def test_returnten():
@@ -133,25 +129,23 @@ def test_returnten():
133129

134130
# Test inset
135131

136-
inset_inner_code = \
137-
'''
132+
inset_inner_code = """
138133
def g(n):
139134
return(n + 10)
140135
141136
def f(n):
142137
return n*2
143-
'''
138+
"""
144139

145140
filename2 = "inner_qwertyuioplkjhgfdsa.se"
146141

147-
inset_outer_code = \
148-
'''
142+
inset_outer_code = """
149143
inset("%s")
150144
151145
def foo():
152146
res = self.g(12)
153147
return res
154-
''' % filename2
148+
""" % filename2
155149

156150

157151
def test_inset():
@@ -163,26 +157,23 @@ def test_inset():
163157

164158
# Inset at the end instead
165159

166-
inset_inner_code2 = \
167-
'''
160+
inset_inner_code2 = """
168161
def g(n):
169162
return(n + 10)
170163
171164
def f(n):
172165
return n*2
173-
'''
166+
"""
174167

175168
filename25 = "inner_qwertyuioplkjhgfdsa.se"
176169

177-
inset_outer_code2 = \
178-
'''
179-
170+
inset_outer_code2 = """
180171
def foo():
181172
res = self.g(12)
182173
return res
183174
184175
inset("%s")
185-
''' % filename25
176+
""" % filename25
186177

187178

188179
def test_inset2():
@@ -195,15 +186,14 @@ def test_inset2():
195186

196187
# Test a simple namecoin implementation
197188

198-
namecoin_code =\
199-
'''
189+
namecoin_code ="""
200190
def main(k, v):
201191
if !self.storage[k]:
202192
self.storage[k] = v
203193
return(1)
204194
else:
205195
return(0)
206-
'''
196+
"""
207197

208198

209199
def test_namecoin():
@@ -220,7 +210,7 @@ def test_namecoin():
220210

221211
# Test a simple currency implementation
222212

223-
currency_code = '''
213+
currency_code = """
224214
data balances[2^160]
225215
226216
def init():
@@ -239,7 +229,7 @@ def send(to, value):
239229
return(1)
240230
else:
241231
return(0)
242-
'''
232+
"""
243233

244234

245235
def test_currency():
@@ -256,7 +246,7 @@ def test_currency():
256246

257247
# Test a data feed
258248

259-
data_feed_code = '''
249+
data_feed_code = """
260250
data creator
261251
data values[]
262252
@@ -273,7 +263,7 @@ def set(k, v):
273263
274264
def get(k):
275265
return(self.values[k])
276-
'''
266+
"""
277267

278268

279269
def test_data_feeds():
@@ -294,7 +284,7 @@ def test_data_feeds():
294284
# Test an example hedging contract, using the data feed. This tests
295285
# contracts calling other contracts
296286

297-
hedge_code = '''
287+
hedge_code = """
298288
extern datafeed: [set:ii, get:i]
299289
300290
data partyone
@@ -333,7 +323,7 @@ def main(datafeed, index):
333323
return(4)
334324
else:
335325
return(5)
336-
'''
326+
"""
337327

338328

339329
def test_hedge():
@@ -370,7 +360,7 @@ def test_hedge():
370360

371361

372362
# Test the LIFO nature of call
373-
arither_code = '''
363+
arither_code = """
374364
def init():
375365
self.storage[0] = 10
376366
@@ -384,7 +374,7 @@ def f2():
384374
385375
def f3():
386376
return(self.storage[0])
387-
'''
377+
"""
388378

389379

390380
def test_lifo():
@@ -395,7 +385,7 @@ def test_lifo():
395385

396386

397387
# Test suicides and suicide reverts
398-
suicider_code = '''
388+
suicider_code = """
399389
def mainloop(rounds):
400390
self.storage[15] = 40
401391
self.suicide()
@@ -416,7 +406,7 @@ def suicide():
416406
417407
def ping_storage15():
418408
return(self.storage[15])
419-
'''
409+
"""
420410

421411

422412
def test_suicider():
@@ -442,7 +432,7 @@ def test_suicider():
442432

443433
# Test reverts
444434

445-
reverter_code = '''
435+
reverter_code = """
446436
def entry():
447437
self.non_recurse(gas=100000)
448438
self.recurse(gas=100000)
@@ -459,7 +449,7 @@ def recurse():
459449
self.recurse()
460450
while msg.gas > 0:
461451
self.storage["waste_some_gas"] = 0
462-
'''
452+
"""
463453

464454

465455
def test_reverter():
@@ -473,16 +463,14 @@ def test_reverter():
473463

474464
# Test stateless contracts
475465

476-
add1_code = \
477-
'''
466+
add1_code = """
478467
def main(x):
479468
self.storage[1] += x
480-
'''
469+
"""
481470

482471
filename3 = "stateless_qwertyuioplkjhgfdsa.se"
483472

484-
callcode_test_code = \
485-
'''
473+
callcode_test_code = """
486474
extern add1: [main:i]
487475
488476
x = create("%s")
@@ -491,7 +479,7 @@ def main(x):
491479
x.main(60, call=code)
492480
x.main(40)
493481
return(self.storage[1])
494-
''' % filename3
482+
""" % filename3
495483

496484

497485
def test_callcode():
@@ -505,26 +493,26 @@ def test_callcode():
505493

506494

507495
# https://github.com/ethereum/serpent/issues/8
508-
array_code = '''
496+
array_code = """
509497
def main():
510498
a = array(1)
511499
a[0] = 1
512500
return(a, items=1)
513-
'''
501+
"""
514502

515503

516504
def test_array():
517505
c = tester.Chain()
518506
x = c.contract(array_code, language='serpent')
519507
assert x.main() == [1]
520508

521-
array_code2 = '''
509+
array_code2 = """
522510
def main():
523511
a = array(1)
524512
something = 2
525513
a[0] = 1
526514
return(a, items=1)
527-
'''
515+
"""
528516

529517

530518
def test_array2():
@@ -1057,8 +1045,7 @@ def test_sort():
10571045

10581046
filename9 = "mul2_qwertyuioplkjhgfdsabarbar.se"
10591047

1060-
sort_tester_code = \
1061-
'''
1048+
sort_tester_code = """
10621049
extern sorter: [sort:a]
10631050
data sorter
10641051
@@ -1067,7 +1054,7 @@ def init():
10671054
10681055
def test(args:arr):
10691056
return(self.sorter.sort(args, outsz=len(args)):arr)
1070-
''' % filename9
1057+
""" % filename9
10711058

10721059

10731060
@pytest.mark.timeout(100)

ethereum/tests/todo/test_serialization.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@
33
import pytest
44

55

6-
mul2_code = \
7-
'''
6+
mul2_code = """
87
def double(v):
98
return(v*2)
10-
'''
9+
"""
1110

1211
filename = "mul2_qwertyuioplkjhgfdsa.se"
1312

14-
returnten_code = \
15-
'''
13+
returnten_code = """
1614
extern mul2: [double:i]
1715
1816
x = create("%s")
1917
return(x.double(5))
20-
''' % filename
18+
""" % filename
2119

2220

2321
@pytest.mark.skip()

0 commit comments

Comments
 (0)