From 330e6f790cf90b1c248260eda8ff0149817f6484 Mon Sep 17 00:00:00 2001 From: ddelange <14880945+ddelange@users.noreply.github.com> Date: Wed, 20 Mar 2024 07:37:08 +0100 Subject: [PATCH] Fix test --- smart_open/tests/test_s3.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/smart_open/tests/test_s3.py b/smart_open/tests/test_s3.py index a0b499df..2b77fe75 100644 --- a/smart_open/tests/test_s3.py +++ b/smart_open/tests/test_s3.py @@ -379,11 +379,13 @@ def test_binary_iterator(self): expected = u"выйду ночью в поле с конём".encode('utf-8').split(b' ') _resource('s3').Object(BUCKET_NAME, KEY_NAME).put(Body=b'\n'.join(expected)) + # test the __iter__ method with self.assertApiCalls(GetObject=1): with smart_open.s3.open(BUCKET_NAME, KEY_NAME, 'rb') as fin: actual = [line.rstrip() for line in fin] self.assertEqual(expected, actual) + # test the __next__ method with self.assertApiCalls(GetObject=1): with smart_open.s3.open(BUCKET_NAME, KEY_NAME, 'rb') as fin: first = next(fin).rstrip() @@ -391,13 +393,17 @@ def test_binary_iterator(self): def test_text_iterator(self): expected = u"выйду ночью в поле с конём".split(' ') - _resource('s3').Object(BUCKET_NAME, KEY_NAME).put(Body=b'\n'.join(expected)) + _resource('s3').Object(BUCKET_NAME, KEY_NAME).put( + Body='\n'.join(expected).encode('utf-8') + ) + # test the __iter__ method with self.assertApiCalls(GetObject=1): with smart_open.s3.open(BUCKET_NAME, KEY_NAME, 'r') as fin: actual = [line.rstrip() for line in fin] self.assertEqual(expected, actual) + # test the __next__ method with self.assertApiCalls(GetObject=1): with smart_open.s3.open(BUCKET_NAME, KEY_NAME, 'r') as fin: first = next(fin).rstrip()