diff options
author | Mike Taves <mwtoews@gmail.com> | 2022-10-28 22:37:29 +1300 |
---|---|---|
committer | Mike Taves <mwtoews@gmail.com> | 2022-10-29 14:08:54 +1300 |
commit | 080cf82ebc5858ec47eff0d49bdf48b74f955274 (patch) | |
tree | c843b284d9994186ab988c7c535a895433ae9905 /numpy/core/tests | |
parent | a8ebbd5fdb9df3d1d2885b24e783757d747dec8e (diff) | |
download | numpy-080cf82ebc5858ec47eff0d49bdf48b74f955274.tar.gz |
MAINT: remove redundant open() modes and io.open() alias
Diffstat (limited to 'numpy/core/tests')
-rw-r--r-- | numpy/core/tests/test_cpu_features.py | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_longdouble.py | 26 |
2 files changed, 14 insertions, 14 deletions
diff --git a/numpy/core/tests/test_cpu_features.py b/numpy/core/tests/test_cpu_features.py index 1a76897e2..44a0a093a 100644 --- a/numpy/core/tests/test_cpu_features.py +++ b/numpy/core/tests/test_cpu_features.py @@ -8,7 +8,7 @@ def assert_features_equal(actual, desired, fname): return detected = str(__cpu_features__).replace("'", "") try: - with open("/proc/cpuinfo", "r") as fd: + with open("/proc/cpuinfo") as fd: cpuinfo = fd.read(2048) except Exception as err: cpuinfo = str(err) diff --git a/numpy/core/tests/test_longdouble.py b/numpy/core/tests/test_longdouble.py index 1a54e62d8..5b76b975b 100644 --- a/numpy/core/tests/test_longdouble.py +++ b/numpy/core/tests/test_longdouble.py @@ -142,7 +142,7 @@ class TestFileBased: def test_fromfile_bogus(self): with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1. 2. 3. flop 4.\n") with assert_warns(DeprecationWarning): @@ -153,7 +153,7 @@ class TestFileBased: for ctype in ["complex", "cdouble", "cfloat"]: # Check spacing between separator and only real component specified with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1, 2 , 3 ,4\n") res = np.fromfile(path, dtype=ctype, sep=",") @@ -161,7 +161,7 @@ class TestFileBased: # Real component not specified with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1j, -2j, 3j, 4e1j\n") res = np.fromfile(path, dtype=ctype, sep=",") @@ -169,7 +169,7 @@ class TestFileBased: # Both components specified with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1+1j,2-2j, -3+3j, -4e1+4j\n") res = np.fromfile(path, dtype=ctype, sep=",") @@ -177,7 +177,7 @@ class TestFileBased: # Spaces at wrong places with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1+2 j,3\n") with assert_warns(DeprecationWarning): @@ -186,7 +186,7 @@ class TestFileBased: # Spaces at wrong places with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1+ 2j,3\n") with assert_warns(DeprecationWarning): @@ -195,7 +195,7 @@ class TestFileBased: # Spaces at wrong places with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1 +2j,3\n") with assert_warns(DeprecationWarning): @@ -204,7 +204,7 @@ class TestFileBased: # Spaces at wrong places with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1+j\n") with assert_warns(DeprecationWarning): @@ -213,7 +213,7 @@ class TestFileBased: # Spaces at wrong places with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1+\n") with assert_warns(DeprecationWarning): @@ -222,7 +222,7 @@ class TestFileBased: # Spaces at wrong places with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write("1j+1\n") with assert_warns(DeprecationWarning): @@ -235,7 +235,7 @@ class TestFileBased: reason="Need strtold_l") def test_fromfile(self): with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write(self.out) res = np.fromfile(path, dtype=np.longdouble, sep="\n") assert_equal(res, self.tgt) @@ -244,7 +244,7 @@ class TestFileBased: reason="Need strtold_l") def test_genfromtxt(self): with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write(self.out) res = np.genfromtxt(path, dtype=np.longdouble) assert_equal(res, self.tgt) @@ -253,7 +253,7 @@ class TestFileBased: reason="Need strtold_l") def test_loadtxt(self): with temppath() as path: - with open(path, 'wt') as f: + with open(path, 'w') as f: f.write(self.out) res = np.loadtxt(path, dtype=np.longdouble) assert_equal(res, self.tgt) |