diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index d840e41476809fccbd36694756641ffd8dcece41..8437a9f20f924ccbff51a4009e110381fb975e51 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 ea57412660021df6d7a5a7ab739c247136ca7d67..cae8f3fb81eaf63b2d596ff4785e071b1222d8c3 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 567f38c96e73ae9bc333bbda642c423ea0742d34..d7107610a5dd751cad8f8365aec32c6ba92c53ae 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):