diff options
Diffstat (limited to 'tensorflow/python/framework')
-rw-r--r-- | tensorflow/python/framework/error_interpolation.py | 2 | ||||
-rw-r--r-- | tensorflow/python/framework/error_interpolation_test.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/tensorflow/python/framework/error_interpolation.py b/tensorflow/python/framework/error_interpolation.py index 46bda2e621..bc3c81b2a2 100644 --- a/tensorflow/python/framework/error_interpolation.py +++ b/tensorflow/python/framework/error_interpolation.py @@ -34,7 +34,7 @@ from tensorflow.python.util import tf_stack _NAME_REGEX = r"[A-Za-z0-9.][A-Za-z0-9_.\-/]*?" _TAG_REGEX = r"{{{{({name}) ({name})}}}}".format(name=_NAME_REGEX) _INTERPOLATION_REGEX = r"^(.*?)({tag})".format(tag=_TAG_REGEX) -_INTERPOLATION_PATTERN = re.compile(_INTERPOLATION_REGEX) +_INTERPOLATION_PATTERN = re.compile(_INTERPOLATION_REGEX, re.DOTALL) _ParseTag = collections.namedtuple("_ParseTag", ["type", "name"]) diff --git a/tensorflow/python/framework/error_interpolation_test.py b/tensorflow/python/framework/error_interpolation_test.py index d312b825d2..1b77548592 100644 --- a/tensorflow/python/framework/error_interpolation_test.py +++ b/tensorflow/python/framework/error_interpolation_test.py @@ -184,9 +184,14 @@ class InterpolateFilenamesAndLineNumbersTest(test.TestCase): interpolated_string = error_interpolation.interpolate( two_tags_with_seps, self.graph) expected_regex = ( - r"^;;;.*constant_op.py:[0-9]+\) ,,,.*constant_op.py:[0-9]*\) ;;;$") + r"^;;;.*constant_op.py:[0-9]+\) ,,,.*constant_op.py:[0-9]+\) ;;;$") self.assertRegexpMatches(interpolated_string, expected_regex) + def testNewLine(self): + newline = "\n\n{{node One}}" + interpolated_string = error_interpolation.interpolate(newline, self.graph) + self.assertRegexpMatches(interpolated_string, "constant_op.py:[0-9]+.*") + class InterpolateDeviceSummaryTest(test.TestCase): |