Unverified Commit 0cb7e02d authored by Katherine Wu's avatar Katherine Wu Committed by GitHub
Browse files

Change unittest tf test (#4485)

parent 26f50b58
...@@ -15,14 +15,13 @@ ...@@ -15,14 +15,13 @@
"""Test functions in compute_blue.py.""" """Test functions in compute_blue.py."""
import tempfile import tempfile
import unittest
import tensorflow as tf # pylint: disable=g-bad-import-order import tensorflow as tf # pylint: disable=g-bad-import-order
from official.transformer import compute_bleu from official.transformer import compute_bleu
class ComputeBleuTest(unittest.TestCase): class ComputeBleuTest(tf.test.TestCase):
def _create_temp_file(self, text): def _create_temp_file(self, text):
temp_file = tempfile.NamedTemporaryFile(delete=False) temp_file = tempfile.NamedTemporaryFile(delete=False)
...@@ -62,4 +61,4 @@ class ComputeBleuTest(unittest.TestCase): ...@@ -62,4 +61,4 @@ class ComputeBleuTest(unittest.TestCase):
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() tf.test.main()
...@@ -16,14 +16,13 @@ ...@@ -16,14 +16,13 @@
import collections import collections
import tempfile import tempfile
import unittest
import tensorflow as tf # pylint: disable=g-bad-import-order import tensorflow as tf # pylint: disable=g-bad-import-order
from official.transformer.utils import tokenizer from official.transformer.utils import tokenizer
class SubtokenizerTest(unittest.TestCase): class SubtokenizerTest(tf.test.TestCase):
def _init_subtokenizer(self, vocab_list): def _init_subtokenizer(self, vocab_list):
temp_file = tempfile.NamedTemporaryFile(delete=False) temp_file = tempfile.NamedTemporaryFile(delete=False)
...@@ -55,7 +54,7 @@ class SubtokenizerTest(unittest.TestCase): ...@@ -55,7 +54,7 @@ class SubtokenizerTest(unittest.TestCase):
self.assertEqual([u"testing", u"123"], token_list) self.assertEqual([u"testing", u"123"], token_list)
class StringHelperTest(unittest.TestCase): class StringHelperTest(tf.test.TestCase):
def test_split_string_to_tokens(self): def test_split_string_to_tokens(self):
text = "test? testing 123." text = "test? testing 123."
...@@ -180,4 +179,4 @@ class StringHelperTest(unittest.TestCase): ...@@ -180,4 +179,4 @@ class StringHelperTest(unittest.TestCase):
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() tf.test.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment