提交 7266073f authored 作者: Frederic's avatar Frederic

fix pep8

上级 2a97ffff
...@@ -28,8 +28,8 @@ def test_pydotprint_cond_highlight(): ...@@ -28,8 +28,8 @@ def test_pydotprint_cond_highlight():
raise SkipTest('pydot not available') raise SkipTest('pydot not available')
x = tensor.dvector() x = tensor.dvector()
f = theano.function([x], x*2) f = theano.function([x], x * 2)
f([1,2,3,4]) f([1, 2, 3, 4])
s = StringIO.StringIO() s = StringIO.StringIO()
new_handler = logging.StreamHandler(s) new_handler = logging.StreamHandler(s)
...@@ -39,19 +39,21 @@ def test_pydotprint_cond_highlight(): ...@@ -39,19 +39,21 @@ def test_pydotprint_cond_highlight():
theano.theano_logger.removeHandler(orig_handler) theano.theano_logger.removeHandler(orig_handler)
theano.theano_logger.addHandler(new_handler) theano.theano_logger.addHandler(new_handler)
try: try:
theano.printing.pydotprint(f, cond_highlight = True, print_output_file=False) theano.printing.pydotprint(f, cond_highlight=True,
print_output_file=False)
finally: finally:
theano.theano_logger.addHandler(orig_handler) theano.theano_logger.addHandler(orig_handler)
theano.theano_logger.removeHandler(new_handler) theano.theano_logger.removeHandler(new_handler)
assert s.getvalue() == 'pydotprint: cond_highlight is set but there is no IfElse node in the graph\n' assert (s.getvalue() == 'pydotprint: cond_highlight is set but there'
' is no IfElse node in the graph\n')
def test_pydotprint_profile(): def test_pydotprint_profile():
"""Just check that pydotprint does not crash with ProfileMode.""" """Just check that pydotprint does not crash with ProfileMode."""
A = tensor.matrix() A = tensor.matrix()
f = theano.function([A], A+1, mode='ProfileMode') f = theano.function([A], A + 1, mode='ProfileMode')
theano.printing.pydotprint(f, print_output_file=False) theano.printing.pydotprint(f, print_output_file=False)
...@@ -59,12 +61,12 @@ def test_min_informative_str(): ...@@ -59,12 +61,12 @@ def test_min_informative_str():
""" evaluates a reference output to make sure the """ evaluates a reference output to make sure the
min_informative_str function works as intended """ min_informative_str function works as intended """
A = tensor.matrix(name = 'A') A = tensor.matrix(name='A')
B = tensor.matrix(name = 'B') B = tensor.matrix(name='B')
C = A + B C = A + B
C.name = 'C' C.name = 'C'
D = tensor.matrix(name = 'D') D = tensor.matrix(name='D')
E = tensor.matrix(name = 'E') E = tensor.matrix(name='E')
F = D + E F = D + E
G = C + F G = C + F
...@@ -78,7 +80,7 @@ def test_min_informative_str(): ...@@ -78,7 +80,7 @@ def test_min_informative_str():
E. E""" E. E"""
if mis != reference: if mis != reference:
print '--'+mis+'--' print '--' + mis + '--'
print '--'+reference+'--' print '--' + reference + '--'
assert mis == reference assert mis == reference
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论