[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 7/9] iotests: replace lambda function by lambda expr
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-block] [PATCH 7/9] iotests: replace lambda function by lambda expression for python3 compatibility |
Date: |
Tue, 19 Dec 2017 14:34:23 -0300 |
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
tests/qemu-iotests/065 | 4 ++--
tests/qemu-iotests/139 | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065
index 72aa9707c7..e95f7f817b 100755
--- a/tests/qemu-iotests/065
+++ b/tests/qemu-iotests/065
@@ -59,7 +59,7 @@ class TestQemuImgInfo(TestImageInfoSpecific):
:data.index('')]
for field in data:
self.assertTrue(re.match('^ {4}[^ ]', field) is not None)
- data = map(lambda line: line.strip(), data)
+ data = [line.strip() for line in data]
self.assertEqual(data, self.human_compare)
class TestQMP(TestImageInfoSpecific):
@@ -80,7 +80,7 @@ class TestQMP(TestImageInfoSpecific):
def test_qmp(self):
result = self.vm.qmp('query-block')['return']
- drive = filter(lambda drive: drive['device'] == 'drive0', result)[0]
+ drive = [drive for drive in result if drive['device'] == 'drive0'][0]
data = drive['inserted']['image']['format-specific']
self.assertEqual(data['type'], iotests.imgfmt)
self.assertEqual(data['data'], self.compare)
diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139
index f8f02808a9..b54c816c16 100644
--- a/tests/qemu-iotests/139
+++ b/tests/qemu-iotests/139
@@ -51,7 +51,7 @@ class TestBlockdevDel(iotests.QMPTestCase):
# Check whether a BlockDriverState exists
def checkBlockDriverState(self, node, must_exist = True):
result = self.vm.qmp('query-named-block-nodes')
- nodes = filter(lambda x: x['node-name'] == node, result['return'])
+ nodes = [x for x in result['return'] if x['node-name'] == node]
self.assertLessEqual(len(nodes), 1)
self.assertEqual(must_exist, len(nodes) == 1)
--
2.15.1
- [Qemu-block] [PATCH 0/9] iotests: python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 3/9] iotests: replace print statement by print() function for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 4/9] iotests: use octal numbers for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 5/9] iotests: replace xrange() by range() for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 6/9] iotests: replace dict.has_key() by 'in' operator for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 7/9] iotests: replace lambda function by lambda expression for python3 compatibility,
Philippe Mathieu-Daudé <=
- [Qemu-block] [PATCH 8/9] iotests: replace assertEquals() by assertEqual() for python3 compatibility, Philippe Mathieu-Daudé, 2017/12/19
- [Qemu-block] [PATCH 9/9] iotests.py: use io.StringIO with python3, Philippe Mathieu-Daudé, 2017/12/19
- Re: [Qemu-block] [PATCH 0/9] iotests: python3 compatibility, Paolo Bonzini, 2017/12/19