summaryrefslogtreecommitdiff
path: root/test/unit/utils.py
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-08-16 13:31:52 -0700
committerGuanzhong Chen <gzchen@google.com>2019-08-16 13:31:52 -0700
commitc8a797d120a1413d993281c98268c1c2ee9f3f94 (patch)
tree30b0d00b8af103e1b8a751f292f0241a02af9a79 /test/unit/utils.py
parentee0564088c7f89814bf951cc5936aa096538e38f (diff)
downloadbinaryen-c8a797d120a1413d993281c98268c1c2ee9f3f94.tar.gz
binaryen-c8a797d120a1413d993281c98268c1c2ee9f3f94.tar.bz2
binaryen-c8a797d120a1413d993281c98268c1c2ee9f3f94.zip
Switch python indentation from 2-space to 4-space (#2299)
pep8 specifies 4 space indentation. The use of 2 spaces is, I believe a historical anomaly where certain large organizations such as google chose 2 over 4 and have yet to make the switch. Since there isn't too much code in binaryen today it seems reasonable to make the switch.
Diffstat (limited to 'test/unit/utils.py')
-rw-r--r--test/unit/utils.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/test/unit/utils.py b/test/unit/utils.py
index 6b18235b5..6aa00aa4f 100644
--- a/test/unit/utils.py
+++ b/test/unit/utils.py
@@ -4,30 +4,30 @@ from scripts.test.shared import WASM_OPT, run_process, options
class BinaryenTestCase(unittest.TestCase):
- def input_path(self, filename):
- return os.path.join(options.binaryen_test, 'unit', 'input', filename)
+ def input_path(self, filename):
+ return os.path.join(options.binaryen_test, 'unit', 'input', filename)
- def roundtrip(self, filename, opts=[]):
- path = self.input_path(filename)
- p = run_process(WASM_OPT + ['-g', '-o', 'a.wasm', path] + opts)
- self.assertEqual(p.returncode, 0)
- with open(path, 'rb') as f:
- with open('a.wasm', 'rb') as g:
- self.assertEqual(g.read(), f.read())
+ def roundtrip(self, filename, opts=[]):
+ path = self.input_path(filename)
+ p = run_process(WASM_OPT + ['-g', '-o', 'a.wasm', path] + opts)
+ self.assertEqual(p.returncode, 0)
+ with open(path, 'rb') as f:
+ with open('a.wasm', 'rb') as g:
+ self.assertEqual(g.read(), f.read())
- def disassemble(self, filename):
- path = self.input_path(filename)
- p = run_process(WASM_OPT + ['--print', '-o', os.devnull, path], check=False,
- capture_output=True)
- self.assertEqual(p.returncode, 0)
- self.assertEqual(p.stderr, '')
- return p.stdout
+ def disassemble(self, filename):
+ path = self.input_path(filename)
+ p = run_process(WASM_OPT + ['--print', '-o', os.devnull, path], check=False,
+ capture_output=True)
+ self.assertEqual(p.returncode, 0)
+ self.assertEqual(p.stderr, '')
+ return p.stdout
- def check_features(self, filename, features, opts=[]):
- path = self.input_path(filename)
- cmd = WASM_OPT + ['--print-features', '-o', os.devnull, path] + opts
- p = run_process(cmd, check=False, capture_output=True)
- self.assertEqual(p.returncode, 0)
- self.assertEqual(p.stderr, '')
- self.assertEqual(p.stdout.split('\n')[:-1],
- ['--enable-' + f for f in features])
+ def check_features(self, filename, features, opts=[]):
+ path = self.input_path(filename)
+ cmd = WASM_OPT + ['--print-features', '-o', os.devnull, path] + opts
+ p = run_process(cmd, check=False, capture_output=True)
+ self.assertEqual(p.returncode, 0)
+ self.assertEqual(p.stderr, '')
+ self.assertEqual(p.stdout.split('\n')[:-1],
+ ['--enable-' + f for f in features])