From 603e11f5e7b8e16977df27b98db187247e33e572 Mon Sep 17 00:00:00 2001 From: Dan Moldovan Date: Tue, 29 Jan 2019 10:36:32 -0800 Subject: [PATCH] Fix mispelled function name. PiperOrigin-RevId: 231429189 --- .../python/autograph/converters/return_statements.py | 2 +- .../autograph/converters/return_statements_test.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tensorflow/python/autograph/converters/return_statements.py b/tensorflow/python/autograph/converters/return_statements.py index 39b4df313ac..c6c6c3ba5ac 100644 --- a/tensorflow/python/autograph/converters/return_statements.py +++ b/tensorflow/python/autograph/converters/return_statements.py @@ -202,7 +202,7 @@ class ReturnStatementsTransformer(converter.Base): def visit_Return(self, node): self.state[_Return].used = True - retval = node.value if node.value else parser.parse_expresison('None') + retval = node.value if node.value else parser.parse_expression('None') template = """ do_return_var_name = True diff --git a/tensorflow/python/autograph/converters/return_statements_test.py b/tensorflow/python/autograph/converters/return_statements_test.py index 2b160d5ac7c..2942555d176 100644 --- a/tensorflow/python/autograph/converters/return_statements_test.py +++ b/tensorflow/python/autograph/converters/return_statements_test.py @@ -187,6 +187,16 @@ class SingleReturnTest(converter_testing.TestCase): self.assertTransformedEquivalent(test_fn, 2) self.assertTransformedEquivalent(test_fn, 4) + def test_null_return(self): + + def test_fn(n): + if n > 4: + return + return + + self.assertTransformedEquivalent(test_fn, 4) + self.assertTransformedEquivalent(test_fn, 5) + if __name__ == '__main__': test.main()