def test_to_dict_is_a_copy(self): metadata = ExtractedMetadata(summary="summary") metadata_dict = metadata.to_dict() metadata_dict["summary"] = "edited summary" # Ensure the metadata cannot be edited with its dict self.assertThat(metadata.get_summary(), Equals("summary"))
def test_to_dict_is_a_copy(self): metadata = ExtractedMetadata(summary="summary") metadata_dict = metadata.to_dict() metadata_dict["summary"] = "edited summary" # Ensure the metadata cannot be edited with its dict self.assertThat(metadata.get_summary(), Equals("summary"))
def test_update_overwrite(self): metadata = ExtractedMetadata(summary="summary", description="description") metadata2 = ExtractedMetadata(description="new description") metadata.update(metadata2) self.assertThat(metadata.get_summary(), Equals("summary")) self.assertThat(metadata.get_description(), Equals("new description"))
def test_update_merge(self): metadata = ExtractedMetadata(summary="summary") metadata2 = ExtractedMetadata(description="description") metadata.update(metadata2) self.assertThat(metadata.get_summary(), Equals("summary")) self.assertThat(metadata.get_description(), Equals("description"))
def test_to_dict_is_a_copy(self): metadata = ExtractedMetadata(summary='summary') metadata_dict = metadata.to_dict() metadata_dict['summary'] = 'edited summary' # Ensure the metadata cannot be edited with its dict self.assertThat(metadata.get_summary(), Equals('summary'))
def test_update_merge(self): metadata = ExtractedMetadata(summary='summary') metadata2 = ExtractedMetadata(description='description') metadata.update(metadata2) self.assertThat(metadata.get_summary(), Equals('summary')) self.assertThat(metadata.get_description(), Equals('description'))
def test_init(self): metadata = ExtractedMetadata(summary="summary") self.assertThat(metadata.get_summary(), Equals("summary")) self.assertThat(metadata.get_description(), Equals(None))
def test_init(self): metadata = ExtractedMetadata(summary="summary") self.assertThat(metadata.get_summary(), Equals("summary")) self.assertThat(metadata.get_description(), Equals(None))