def test_schema_org(self): schema_str = document_datasets.document_single_builder(self.builder) self.assertIn('http://schema.org/Dataset', schema_str) self.assertIn( '<meta itemprop="url" ' 'content="https://www.tensorflow.org' '/datasets/catalog/%s" />' % self.builder.name, schema_str)
def test_with_config(self): """Test that builder with configs are correctly generated.""" with testing.tmp_dir() as tmp_dir: builder = DummyMnistConfigs(data_dir=tmp_dir) builder.download_and_prepare() doc_str = document_datasets.document_single_builder(builder) self.assertIn("Some manual instructions.", doc_str) self.assertIn("Mnist description.", doc_str) # Shared description. self.assertIn("Config description.", doc_str) # Config-specific description
def generate_docs_with_visualization(ds_name): """ Prepare builder and generate example figures to /examples folder """ builder = tfds.builder(ds_name) builder.download_and_prepare() dst_dir = tfds.core.get_tfds_path(FIG_DIR) with open(os.path.join(dst_dir, f'{ds_name}.md'), "w") as f: doc_builder = document_datasets.document_single_builder(builder) f.write(doc_builder)