From 47561c34b0fdd27df852dbf2c09230bf3bee412b Mon Sep 17 00:00:00 2001 From: minqiyang Date: Mon, 13 Aug 2018 15:59:33 +0800 Subject: [PATCH] Fix python2 CI issues --- python/paddle/fluid/executor.py | 5 ++--- python/paddle/fluid/tests/unittests/test_lod_rank_table.py | 2 +- python/paddle/reader/tests/creator_test.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index d840e414768..8437a9f20f9 100644 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -320,9 +320,8 @@ class Executor(object): # append fetch_operators if not has_fetch_operators(global_block, fetch_list, fetch_var_name): for i, var in enumerate(fetch_list): - assert isinstance(var, Variable) or isinstance( - var, six.text_type), ("Wrong type for fetch_list[%s]: %s" % - (i, type(var))) + assert isinstance(var, Variable) or isinstance(var, str), ( + "Wrong type for fetch_list[%s]: %s" % (i, type(var))) global_block.append_op( type='fetch', inputs={'X': [var]}, diff --git a/python/paddle/fluid/tests/unittests/test_lod_rank_table.py b/python/paddle/fluid/tests/unittests/test_lod_rank_table.py index ea574126600..cae8f3fb81e 100644 --- a/python/paddle/fluid/tests/unittests/test_lod_rank_table.py +++ b/python/paddle/fluid/tests/unittests/test_lod_rank_table.py @@ -37,7 +37,7 @@ class TestLoDRankTable(unittest.TestCase): exe.run(scope=scope, feed={'x': tensor}) var = scope.find_var(rank_table.name) table = var.get_lod_rank_table() - self.assertEqual([(0, 5), (1, 1), (2, 1)], six.iteritems(table)) + self.assertEqual([(0, 5), (1, 1), (2, 1)], list(six.iteritems(table))) if __name__ == '__main__': diff --git a/python/paddle/reader/tests/creator_test.py b/python/paddle/reader/tests/creator_test.py index 567f38c96e7..d7107610a5d 100644 --- a/python/paddle/reader/tests/creator_test.py +++ b/python/paddle/reader/tests/creator_test.py @@ -38,7 +38,7 @@ class TestNumpyArray(unittest.TestCase): x = np.array(l, np.int32) reader = paddle.reader.creator.np_array(x) for idx, e in enumerate(reader()): - six.assertCountEqual(e, l[idx]) + six.assertCountEqual(self, e, l[idx]) class TestTextFile(unittest.TestCase): -- GitLab