Set filecmp.cmp(shallow=False) in model_maker unit tests.

PiperOrigin-RevId: 498218578
This commit is contained in:
MediaPipe Team 2022-12-28 11:22:52 -08:00 committed by Copybara-Service
parent 175aff9be8
commit 7e36a5e2ae
2 changed files with 7 additions and 3 deletions

View File

@ -72,8 +72,10 @@ class TextClassifierTest(tf.test.TestCase):
self.assertTrue(os.path.exists(output_metadata_file)) self.assertTrue(os.path.exists(output_metadata_file))
self.assertGreater(os.path.getsize(output_metadata_file), 0) self.assertGreater(os.path.getsize(output_metadata_file), 0)
self.assertTrue( self.assertTrue(
filecmp.cmp(output_metadata_file, filecmp.cmp(
self._AVERAGE_WORD_EMBEDDING_JSON_FILE)) output_metadata_file,
self._AVERAGE_WORD_EMBEDDING_JSON_FILE,
shallow=False))
def test_create_and_train_bert(self): def test_create_and_train_bert(self):
train_data, validation_data = self._get_data() train_data, validation_data = self._get_data()

View File

@ -135,7 +135,9 @@ class ImageClassifierTest(tf.test.TestCase, parameterized.TestCase):
self.assertTrue(os.path.exists(output_metadata_file)) self.assertTrue(os.path.exists(output_metadata_file))
self.assertGreater(os.path.getsize(output_metadata_file), 0) self.assertGreater(os.path.getsize(output_metadata_file), 0)
self.assertTrue(filecmp.cmp(output_metadata_file, expected_metadata_file)) self.assertTrue(
filecmp.cmp(
output_metadata_file, expected_metadata_file, shallow=False))
def test_continual_training_by_loading_checkpoint(self): def test_continual_training_by_loading_checkpoint(self):
mock_stdout = io.StringIO() mock_stdout = io.StringIO()