summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r--numpy/lib/tests/test_io.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 0756cc646..b39db72eb 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -560,7 +560,7 @@ class TestSaveTxt:
s.seek(0)
assert_equal(s.read(), utf8 + '\n')
- @pytest.mark.parametrize("fmt", [u"%f", b"%f"])
+ @pytest.mark.parametrize("fmt", ["%f", b"%f"])
@pytest.mark.parametrize("iotype", [StringIO, BytesIO])
def test_unicode_and_bytes_fmt(self, fmt, iotype):
# string type of fmt should not matter, see also gh-4053
@@ -569,7 +569,7 @@ class TestSaveTxt:
np.savetxt(s, a, fmt=fmt)
s.seek(0)
if iotype is StringIO:
- assert_equal(s.read(), u"%f\n" % 1.)
+ assert_equal(s.read(), "%f\n" % 1.)
else:
assert_equal(s.read(), b"%f\n" % 1.)
@@ -763,7 +763,7 @@ class TestLoadTxt(LoadTxtBase):
c.write('# comment\n1,2,3,5\n')
c.seek(0)
x = np.loadtxt(c, dtype=int, delimiter=',',
- comments=u'#')
+ comments='#')
a = np.array([1, 2, 3, 5], int)
assert_array_equal(x, a)
@@ -1514,7 +1514,7 @@ M 33 21.99
with tempdir() as tmpdir:
fpath = os.path.join(tmpdir, "test.csv")
with open(fpath, "wb") as f:
- f.write(u'\N{GREEK PI SYMBOL}'.encode('utf8'))
+ f.write('\N{GREEK PI SYMBOL}'.encode())
# ResourceWarnings are emitted from a destructor, so won't be
# detected by regular propagation to errors.
@@ -2174,9 +2174,9 @@ M 33 21.99
test = np.genfromtxt(TextIO(s),
dtype=None, comments=None, delimiter=',',
encoding='latin1')
- assert_equal(test[1, 0], u"test1")
- assert_equal(test[1, 1], u"testNonethe" + latin1.decode('latin1'))
- assert_equal(test[1, 2], u"test3")
+ assert_equal(test[1, 0], "test1")
+ assert_equal(test[1, 1], "testNonethe" + latin1.decode('latin1'))
+ assert_equal(test[1, 2], "test3")
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings('always', '', np.VisibleDeprecationWarning)
@@ -2230,8 +2230,8 @@ M 33 21.99
def test_utf8_file_nodtype_unicode(self):
# bytes encoding with non-latin1 -> unicode upcast
- utf8 = u'\u03d6'
- latin1 = u'\xf6\xfc\xf6'
+ utf8 = '\u03d6'
+ latin1 = '\xf6\xfc\xf6'
# skip test if cannot encode utf8 test string with preferred
# encoding. The preferred encoding is assumed to be the default
@@ -2246,9 +2246,9 @@ M 33 21.99
with temppath() as path:
with io.open(path, "wt") as f:
- f.write(u"norm1,norm2,norm3\n")
- f.write(u"norm1," + latin1 + u",norm3\n")
- f.write(u"test1,testNonethe" + utf8 + u",test3\n")
+ f.write("norm1,norm2,norm3\n")
+ f.write("norm1," + latin1 + ",norm3\n")
+ f.write("test1,testNonethe" + utf8 + ",test3\n")
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings('always', '',
np.VisibleDeprecationWarning)
@@ -2583,7 +2583,7 @@ class TestPathUsage:
with temppath(suffix='.txt') as path:
path = Path(path)
with path.open('w') as f:
- f.write(u'A,B\n0,1\n2,3')
+ f.write('A,B\n0,1\n2,3')
kwargs = dict(delimiter=",", missing_values="N/A", names=True)
test = np.recfromtxt(path, **kwargs)
@@ -2596,7 +2596,7 @@ class TestPathUsage:
with temppath(suffix='.txt') as path:
path = Path(path)
with path.open('w') as f:
- f.write(u'A,B\n0,1\n2,3')
+ f.write('A,B\n0,1\n2,3')
kwargs = dict(missing_values="N/A", names=True, case_sensitive=True)
test = np.recfromcsv(path, dtype=None, **kwargs)