MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / VersionTest

Function VersionTest

tensorflow/core/util/tensor_bundle/tensor_bundle_test.cc:504–523  ·  view source on GitHub ↗

Writes a bundle to disk with a bad "version"; checks for "expected_error".

Source from the content-addressed store, hash-verified

502
503// Writes a bundle to disk with a bad "version"; checks for "expected_error".
504void VersionTest(const VersionDef& version, StringPiece expected_error) {
505 const string path = Prefix("version_test");
506 {
507 // Prepare an empty bundle with the given version information.
508 BundleHeaderProto header;
509 *header.mutable_version() = version;
510
511 // Write the metadata file to disk.
512 std::unique_ptr<WritableFile> file;
513 TF_ASSERT_OK(Env::Default()->NewWritableFile(MetaFilename(path), &file));
514 table::TableBuilder builder(table::Options(), file.get());
515 builder.Add(kHeaderEntryKey, header.SerializeAsString());
516 TF_ASSERT_OK(builder.Finish());
517 }
518 // Read it back in and verify that we get the expected error.
519 BundleReader reader(Env::Default(), path);
520 EXPECT_TRUE(errors::IsInvalidArgument(reader.status()));
521 EXPECT_TRUE(
522 absl::StartsWith(reader.status().error_message(), expected_error));
523}
524
525} // namespace
526

Callers 1

TESTFunction · 0.70

Calls 11

DefaultFunction · 0.85
MetaFilenameFunction · 0.85
StartsWithFunction · 0.85
PrefixFunction · 0.70
OptionsClass · 0.70
NewWritableFileMethod · 0.45
getMethod · 0.45
AddMethod · 0.45
SerializeAsStringMethod · 0.45
FinishMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected