Minor change in update script

PiperOrigin-RevId: 297221831
Change-Id: Ibc864c21ad7bd277ffe00caecb9751629f89d97b
This commit is contained in:
Yanhua Sun 2020-02-25 15:42:53 -08:00 committed by TensorFlower Gardener
parent 78b9c0aa02
commit 5de7e810ab
2 changed files with 3 additions and 12 deletions

View File

@ -47,19 +47,12 @@ class TFAPIChangeSpec(ast_edits.APIChangeSpec):
# List module renames. If changed, please update max_submodule_depth.
self.import_renames = {
"tensorflow.google":
ast_edits.ImportRename(
"tensorflow.google.compat.v1",
excluded_prefixes=[
"tensorflow.google.compat.v1",
"tensorflow.google.compat.v2",
],
),
"tensorflow":
ast_edits.ImportRename(
"tensorflow.compat.v1",
excluded_prefixes=[
"tensorflow.contrib", "tensorflow.flags",
"tensorflow.compat",
"tensorflow.compat.v1", "tensorflow.compat.v2",
"tensorflow.google"
],

View File

@ -70,14 +70,12 @@ class TfUpgradeV2SafetyTest(test_util.TensorFlowTestCase):
def testTensorFlowGoogleImport(self):
text = "import tensorflow.google as tf"
expected_text = "import tensorflow.google.compat.v1 as tf"
_, _, _, new_text = self._upgrade(text)
self.assertEqual(expected_text, new_text)
self.assertEqual(text, new_text)
text = "import tensorflow.google"
expected_text = "import tensorflow.google.compat.v1"
_, _, _, new_text = self._upgrade(text)
self.assertEqual(expected_text, new_text)
self.assertEqual(text, new_text)
text = "import tensorflow.google.compat.v1 as tf"
expected_text = "import tensorflow.google.compat.v1 as tf"