forked from mindspore-Ecosystem/mindspore
Fix pylint issues in test_cont_break.py
Fix 'Useless super delegation in method __init__'; Also fix class naming problem.
This commit is contained in:
parent
99a5dacdc7
commit
92d60f4c6f
|
@ -32,10 +32,7 @@ def run_test(netclass, count, dev):
|
||||||
np.testing.assert_array_almost_equal(output_np, output_ms.asnumpy(), decimal=3)
|
np.testing.assert_array_almost_equal(output_np, output_ms.asnumpy(), decimal=3)
|
||||||
|
|
||||||
|
|
||||||
class for_loop_with_break(Cell):
|
class ForLoopWithBreak(Cell):
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def construct(self, x):
|
def construct(self, x):
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
if i > 5:
|
if i > 5:
|
||||||
|
@ -45,10 +42,7 @@ class for_loop_with_break(Cell):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
class for_loop_with_continue(Cell):
|
class ForLoopWithContinue(Cell):
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def construct(self, x):
|
def construct(self, x):
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
if i > 5:
|
if i > 5:
|
||||||
|
@ -58,10 +52,7 @@ class for_loop_with_continue(Cell):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
class for_loop_with_cont_break(Cell):
|
class ForLoopWithContBreak(Cell):
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def construct(self, x):
|
def construct(self, x):
|
||||||
for i in range(8):
|
for i in range(8):
|
||||||
if i < 3:
|
if i < 3:
|
||||||
|
@ -74,10 +65,7 @@ class for_loop_with_cont_break(Cell):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
class for_nested_loop_with_break(Cell):
|
class ForNestedLoopWithBreak(Cell):
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def construct(self, x):
|
def construct(self, x):
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
for j in range(5):
|
for j in range(5):
|
||||||
|
@ -88,10 +76,7 @@ class for_nested_loop_with_break(Cell):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
class while_with_break(Cell):
|
class WhileWithBreak(Cell):
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def construct(self, x):
|
def construct(self, x):
|
||||||
i = 0
|
i = 0
|
||||||
while i < 5:
|
while i < 5:
|
||||||
|
@ -103,10 +88,7 @@ class while_with_break(Cell):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
class while_with_continue(Cell):
|
class WhileWithContinue(Cell):
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def construct(self, x):
|
def construct(self, x):
|
||||||
i = 0
|
i = 0
|
||||||
while i < 5:
|
while i < 5:
|
||||||
|
@ -119,10 +101,7 @@ class while_with_continue(Cell):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
class while_for_nested(Cell):
|
class WhileForNested(Cell):
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def construct(self, x):
|
def construct(self, x):
|
||||||
i = 0
|
i = 0
|
||||||
while i < 5:
|
while i < 5:
|
||||||
|
@ -138,10 +117,7 @@ class while_for_nested(Cell):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|
||||||
class pass_branch(Cell):
|
class PassBranch(Cell):
|
||||||
def __init__(self):
|
|
||||||
super().__init__()
|
|
||||||
|
|
||||||
def construct(self, x):
|
def construct(self, x):
|
||||||
i = 0
|
i = 0
|
||||||
while i < 5:
|
while i < 5:
|
||||||
|
@ -159,11 +135,11 @@ class pass_branch(Cell):
|
||||||
def test_cont_break():
|
def test_cont_break():
|
||||||
count = 20
|
count = 20
|
||||||
dev = 'CPU'
|
dev = 'CPU'
|
||||||
run_test(for_loop_with_break, count, dev)
|
run_test(ForLoopWithBreak, count, dev)
|
||||||
run_test(for_loop_with_continue, count, dev)
|
run_test(ForLoopWithContinue, count, dev)
|
||||||
run_test(for_loop_with_cont_break, count, dev)
|
run_test(ForLoopWithContBreak, count, dev)
|
||||||
run_test(for_nested_loop_with_break, count, dev)
|
run_test(ForNestedLoopWithBreak, count, dev)
|
||||||
run_test(while_with_break, count, dev)
|
run_test(WhileWithBreak, count, dev)
|
||||||
run_test(while_with_continue, count, dev)
|
run_test(WhileWithContinue, count, dev)
|
||||||
run_test(while_for_nested, count, dev)
|
run_test(WhileForNested, count, dev)
|
||||||
run_test(pass_branch, count, dev)
|
run_test(PassBranch, count, dev)
|
||||||
|
|
Loading…
Reference in New Issue