mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
python scripts: Some pylint tweaks.
This commit is contained in:
@@ -8,12 +8,9 @@
|
||||
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
import hashlib
|
||||
from os.path import join
|
||||
|
||||
def extract_test_cases(path):
|
||||
lines = open(path, 'rb').read().splitlines()
|
||||
def extract_test_cases(_path):
|
||||
lines = open(_path, 'rb').read().splitlines()
|
||||
|
||||
inside = False
|
||||
delimiter = ''
|
||||
@@ -23,27 +20,24 @@ def extract_test_cases(path):
|
||||
test_name = ''
|
||||
|
||||
for l in lines:
|
||||
if inside:
|
||||
if l.strip().endswith(')' + delimiter + '";'):
|
||||
open('%03d_%s.sol' % (ctr, test_name), 'wb').write(test)
|
||||
ctr += 1
|
||||
inside = False
|
||||
test = ''
|
||||
if inside:
|
||||
if l.strip().endswith(')' + delimiter + '";'):
|
||||
open('%03d_%s.sol' % (ctr, test_name), 'wb').write(test)
|
||||
ctr += 1
|
||||
inside = False
|
||||
test = ''
|
||||
else:
|
||||
l = re.sub('^\t\t', '', l)
|
||||
l = l.replace('\t', ' ')
|
||||
test += l + '\n'
|
||||
else:
|
||||
l = re.sub('^\t\t', '', l)
|
||||
l = l.replace('\t', ' ')
|
||||
test += l + '\n'
|
||||
else:
|
||||
m = re.search(r'BOOST_AUTO_TEST_CASE\(([^(]*)\)', l.strip())
|
||||
if m:
|
||||
test_name = m.group(1)
|
||||
m = re.search(r'R"([^(]*)\($', l.strip())
|
||||
if m:
|
||||
inside = True
|
||||
delimiter = m.group(1)
|
||||
|
||||
m = re.search(r'BOOST_AUTO_TEST_CASE\(([^(]*)\)', l.strip())
|
||||
if m:
|
||||
test_name = m.group(1)
|
||||
m = re.search(r'R"([^(]*)\($', l.strip())
|
||||
if m:
|
||||
inside = True
|
||||
delimiter = m.group(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
path = sys.argv[1]
|
||||
extract_test_cases(path)
|
||||
|
||||
extract_test_cases(sys.argv[1])
|
||||
|
||||
Reference in New Issue
Block a user