-
Notifications
You must be signed in to change notification settings - Fork 74k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Account for the existence of None values in lists of AST nodes. This …
…can happen in Python 3 when keyword-only arguments are used. Fixes #28725. PiperOrigin-RevId: 253034028
- Loading branch information
1 parent
888a58e
commit 22ba2eb
Showing
4 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# python3 | ||
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
"""Tests for api module.""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
import os | ||
|
||
from tensorflow.python.autograph.core import converter | ||
from tensorflow.python.autograph.impl import api | ||
from tensorflow.python.framework import constant_op | ||
from tensorflow.python.platform import test | ||
|
||
|
||
class ApiTest(test.TestCase): | ||
|
||
def test_converted_call_kwonly_args(self): | ||
|
||
def test_fn(*, a): | ||
return a | ||
|
||
x = api.converted_call(test_fn, None, | ||
converter.ConversionOptions(recursive=True), | ||
(), {'a': constant_op.constant(-1)}) | ||
self.assertEqual(-1, self.evaluate(x)) | ||
|
||
|
||
if __name__ == '__main__': | ||
os.environ['AUTOGRAPH_STRICT_CONVERSION'] = '1' | ||
test.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters