Skip to content

Commit 51cae84

Browse files
committed
update unittests, test=develop
1 parent 5e206bc commit 51cae84

File tree

2 files changed

+5
-32
lines changed

2 files changed

+5
-32
lines changed

python/paddle/fluid/tests/unittests/test_feed_data_check_shape_type.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,8 @@ def test(self):
8686
self._test_feed_lod_tensor(use_cuda, use_parallel_executor)
8787

8888
# Test exception message when feeding with error
89-
if six.PY2:
90-
in_shape_tuple = (long(-1), long(3), long(4), long(8))
91-
error_shape_list = [
92-
long(self.data_batch_size), long(3), long(4), long(5)
93-
]
94-
else:
95-
in_shape_tuple = (-1, 3, 4, 8)
96-
error_shape_list = [self.data_batch_size, 3, 4, 5]
89+
in_shape_tuple = (-1, 3, 4, 8)
90+
error_shape_list = [self.data_batch_size, 3, 4, 5]
9791

9892
with self.assertRaises(ValueError) as shape_mismatch_err:
9993
self._test_feed_data_shape_mismatch(use_cuda,

python/paddle/fluid/tests/unittests/test_var_base.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -430,18 +430,7 @@ def test_tensor_str(self):
430430
paddle.set_printoptions(4, 100, 3)
431431
a_str = str(a)
432432

433-
if six.PY2:
434-
expected = '''Tensor(shape=[10L, 20L], dtype=float32, place=CPUPlace, stop_gradient=True,
435-
[[0.2727, 0.5489, 0.8655, ..., 0.2916, 0.8525, 0.9000],
436-
[0.3806, 0.8996, 0.0928, ..., 0.9535, 0.8378, 0.6409],
437-
[0.1484, 0.4038, 0.8294, ..., 0.0148, 0.6520, 0.4250],
438-
...,
439-
[0.3426, 0.1909, 0.7240, ..., 0.4218, 0.2676, 0.5679],
440-
[0.5561, 0.2081, 0.0676, ..., 0.9778, 0.3302, 0.9559],
441-
[0.2665, 0.8483, 0.5389, ..., 0.4956, 0.6862, 0.9178]])'''
442-
443-
else:
444-
expected = '''Tensor(shape=[10, 20], dtype=float32, place=CPUPlace, stop_gradient=True,
433+
expected = '''Tensor(shape=[10, 20], dtype=float32, place=CPUPlace, stop_gradient=True,
445434
[[0.2727, 0.5489, 0.8655, ..., 0.2916, 0.8525, 0.9000],
446435
[0.3806, 0.8996, 0.0928, ..., 0.9535, 0.8378, 0.6409],
447436
[0.1484, 0.4038, 0.8294, ..., 0.0148, 0.6520, 0.4250],
@@ -458,12 +447,7 @@ def test_tensor_str2(self):
458447
a = paddle.to_tensor([[1.5111111, 1.0], [0, 0]])
459448
a_str = str(a)
460449

461-
if six.PY2:
462-
expected = '''Tensor(shape=[2L, 2L], dtype=float32, place=CPUPlace, stop_gradient=True,
463-
[[1.5111, 1. ],
464-
[0. , 0. ]])'''
465-
else:
466-
expected = '''Tensor(shape=[2, 2], dtype=float32, place=CPUPlace, stop_gradient=True,
450+
expected = '''Tensor(shape=[2, 2], dtype=float32, place=CPUPlace, stop_gradient=True,
467451
[[1.5111, 1. ],
468452
[0. , 0. ]])'''
469453

@@ -475,12 +459,7 @@ def test_tensor_str3(self):
475459
a = paddle.to_tensor([[-1.5111111, 1.0], [0, -0.5]])
476460
a_str = str(a)
477461

478-
if six.PY2:
479-
expected = '''Tensor(shape=[2L, 2L], dtype=float32, place=CPUPlace, stop_gradient=True,
480-
[[-1.5111, 1. ],
481-
[ 0. , -0.5000]])'''
482-
else:
483-
expected = '''Tensor(shape=[2, 2], dtype=float32, place=CPUPlace, stop_gradient=True,
462+
expected = '''Tensor(shape=[2, 2], dtype=float32, place=CPUPlace, stop_gradient=True,
484463
[[-1.5111, 1. ],
485464
[ 0. , -0.5000]])'''
486465

0 commit comments

Comments
 (0)