How to use has_entry method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

test_id3_container.py

Source:test_id3_container.py Github

copy

Full Screen

...17 yield maker18 tmpdir.remove()19def test_reads_album_title_from_talb_frame(mp3):20 metadata = container.load(mp3(TALB="Album"))21 assert_that(metadata, has_entry("release_name", "Album"), "metadata")22def test_joins_all_texts_of_frames(mp3):23 metadata = container.load(mp3(TALB=["Album", "Titles"]))24 assert_that(metadata, has_entry("release_name", "Album\x00Titles"), "metadata")25def test_reads_lead_performer_from_tpe1_frame(mp3):26 metadata = container.load(mp3(TPE1="Lead Artist"))27 assert_that(metadata, has_entry("lead_performer", "Lead Artist"), "metadata")28def test_reads_guest_performers_from_tmcl_frame(mp3):29 metadata = container.load(mp3(TMCL=[["Guitar", "Guitarist"], ["Guitar", "Bassist"],30 ["Piano", "Pianist"]]))31 assert_that(metadata, has_entry("guest_performers", contains_inanyorder(32 ("Guitar", "Guitarist"),33 ("Guitar", "Bassist"),34 ("Piano", "Pianist"))), "metadata")35def test_ignores_tmcl_entries_with_blank_names(mp3):36 metadata = container.load(mp3(TMCL=[["Guitar", "Guitarist"], ["Piano", ""]]))37 assert_that(metadata, has_entry("guest_performers", contains(("Guitar", "Guitarist"))), "metadata")38def test_reads_label_name_from_town_frame(mp3):39 metadata = container.load(mp3(TOWN="Label Name"))40 assert_that(metadata, has_entry("label_name", "Label Name"), "metadata")41def test_reads_catalog_number_from_custom_frame(mp3):42 metadata = container.load(mp3(TXXX_CATALOG_NUMBER="123 456-1"))43 assert_that(metadata, has_entry("catalog_number", "123 456-1"), "metadata")44def test_reads_upc_from_custom_barcode_frame(mp3):45 metadata = container.load(mp3(TXXX_BARCODE="1234567899999"))46 assert_that(metadata, has_entry("upc", "1234567899999"), "metadata")47def test_reads_recording_time_from_tdrc_frame(mp3):48 metadata = container.load(mp3(TDRC="2012-07-15"))49 assert_that(metadata, has_entry("recording_time", "2012-07-15"), "metadata")50def test_reads_release_time_from_tdrl_frame(mp3):51 metadata = container.load(mp3(TDRL="2013-11-15"))52 assert_that(metadata, has_entry("release_time", "2013-11-15"), "metadata")53def test_reads_original_release_time_from_tdor_frame(mp3):54 metadata = container.load(mp3(TDOR="1999-03-15"))55 assert_that(metadata, has_entry("original_release_time", "1999-03-15"), "metadata")56def test_reads_recording_studio_from_custom_frame(mp3):57 metadata = container.load(mp3(TXXX_RECORDING_STUDIO="Studio Name"))58 assert_that(metadata, has_entry("recording_studio", "Studio Name"), "metadata")59def test_reads_music_producer_from_tipl_frame(mp3):60 metadata = container.load(mp3(TIPL=[["producer", "Music Producer"]]))61 assert_that(metadata, has_entry("music_producer", "Music Producer"), "metadata")62def test_takes_into_account_last_of_multiple_role_definitions(mp3):63 metadata = container.load(mp3(TIPL=[["producer", "first"], ["producer", "last"]]))64 assert_that(metadata, has_entry("music_producer", "last"), "metadata")65def test_ignores_tpil_entries_with_blank_names(mp3):66 metadata = container.load(mp3(TIPL=[["producer", ""]]))67 assert_that(metadata, is_not(has_key("producer")), "metadata")68def test_reads_mixing_engineer_from_tipl_frame(mp3):69 metadata = container.load(mp3(TIPL=[["mix", "Mixing Engineer"]]))70 assert_that(metadata, has_entry("mixer", "Mixing Engineer"), "metadata")71def test_reads_comments_from_french_comm_frame(mp3):72 metadata = container.load(mp3(COMM=("Comments", "fra")))73 assert_that(metadata, has_entry("comments", "Comments"), "metadata")74def test_reads_track_title_from_tit2_frame(mp3):75 metadata = container.load(mp3(TIT2="Track Title"))76 assert_that(metadata, has_entry("track_title", "Track Title"), "metadata")77def test_reads_version_info_from_tpe4_frame(mp3):78 metadata = container.load(mp3(TPE4="Version Info"))79 assert_that(metadata, has_entry("version_info", "Version Info"), "metadata")80def test_reads_featured_guest_from_custom_frame(mp3):81 metadata = container.load(mp3(TXXX_FEATURED_GUEST="Featured Guest"))82 assert_that(metadata, has_entry("featured_guest", "Featured Guest"), "metadata")83def test_reads_lyricist_from_text_frame(mp3):84 metadata = container.load(mp3(TEXT=["Lyricist1", "Lyricist2", "Lyricist3"]))85 assert_that(metadata, has_entry("lyricist", contains("Lyricist1", "Lyricist2", "Lyricist3")), "metadata")86def test_reads_composer_from_tcom_frame(mp3):87 metadata = container.load(mp3(TCOM=["Composer1", "Composer2", "Composer3"]))88 assert_that(metadata, has_entry("composer", contains("Composer1", "Composer2", "Composer3")), "metadata")89def test_reads_publisher_from_tpub_frame(mp3):90 metadata = container.load(mp3(TPUB=["Publisher1", "Publisher2", "Publisher3"]))91 assert_that(metadata, has_entry("publisher", contains("Publisher1", "Publisher2", "Publisher3")), "metadata")92def test_reads_isrc_from_tsrc_frame(mp3):93 metadata = container.load(mp3(TSRC="AABB12345678"))94 assert_that(metadata, has_entry("isrc", "AABB12345678"), "metadata")95def test_reads_tags_from_custom_frame(mp3):96 metadata = container.load(mp3(TXXX_TAGS="Tag1 Tag2 Tag3"))97 assert_that(metadata, has_entry("labels", "Tag1 Tag2 Tag3"), "metadata")98def test_reads_isni_from_custom_frame(mp3):99 metadata = container.load(mp3(TXXX_ISNI_Joel_Miller="00000123456789"))100 assert_that(metadata, has_entry("isnis", has_entry("Joel Miller", "00000123456789")), "metadata")101def test_reads_iswc_from_custom_frame(mp3):102 metadata = container.load(mp3(TXXX_ISWC="T-345246800-1"))103 assert_that(metadata, has_entry("iswc", "T-345246800-1"), "metadata")104def test_reads_lyrics_from_uslt_french_frame(mp3):105 metadata = container.load(mp3(USLT=("Lyrics", "fra")))106 assert_that(metadata, has_entry("lyrics", "Lyrics"), "metadata")107def test_reads_language_from_tlan_frame(mp3):108 metadata = container.load(mp3(TLAN="fra"))109 assert_that(metadata, has_entry("language", "fra"), "metadata")110def test_reads_primary_style_from_tcon_frame(mp3):111 metadata = container.load(mp3(TCON="Jazz"))112 assert_that(metadata, has_entry("primary_style", "Jazz"), "metadata")113def test_reads_compilation_flag_from_non_standard_tcmp_frame(mp3):114 metadata = container.load(mp3(TCMP="0"))115 assert_that(metadata, has_entry("compilation", False), "metadata")116 metadata = container.load(mp3(TCMP="1"))117 assert_that(metadata, has_entry("compilation", True), "metadata")118def test_reads_bitrate_from_audio_stream_information(mp3):119 metadata = container.load(mp3())120 assert_that(metadata, has_entry("bitrate", BITRATE), "bitrate")121def test_reads_duration_from_audio_stream_information(mp3):122 metadata = container.load(mp3())123 assert_that(metadata, has_entry("duration", DURATION), "duration")124def test_reads_cover_pictures_from_apic_frames(mp3):125 metadata = container.load(mp3(126 APIC_FRONT=("image/jpeg", "Front", b"front-cover.jpg"),127 APIC_BACK=("image/jpeg", "Back", b"back-cover.jpg")))128 assert_that(metadata.images, contains_inanyorder(129 Image("image/jpeg", b"front-cover.jpg", type_=Image.FRONT_COVER, desc="Front"),130 Image("image/jpeg", b"back-cover.jpg", type_=Image.BACK_COVER, desc="Back"),131 ))132def test_reads_tagger_name_from_custom_frame(mp3):133 metadata = container.load(mp3(TXXX_TAGGER="TGiT"))134 assert_that(metadata, has_entry("tagger", "TGiT"), "metadata")135def test_reads_tagger_version_from_custom_frame(mp3):136 metadata = container.load(mp3(TXXX_TAGGER_VERSION="1.0"))137 assert_that(metadata, has_entry("tagger_version", "1.0"), "metadata")138def test_reads_tagging_time_from_tdtg_frame(mp3):139 metadata = container.load(mp3(TDTG="2014-03-26T18:18:55"))140 assert_that(metadata, has_entry("tagging_time", "2014-03-26 18:18:55"), "metadata")141def test_reads_track_number_from_trck_frame(mp3):142 metadata = container.load(mp3(TRCK="3"))143 assert_that(metadata, has_entry("track_number", 3), "metadata")144def test_reads_total_tracks_from_trck_frame(mp3):145 metadata = container.load(mp3(TRCK="3/5"))146 assert_that(metadata, has_entry("total_tracks", 5), "metadata")147def test_reads_lead_performer_region_from_custom_frame(mp3):148 metadata = container.load(mp3(TXXX_LEAD_PERFORMER_REGION="CA MTL"))149 assert_that(metadata, has_entry("lead_performer_region", ("CA", "MTL")), "metadata")150def test_reads_lead_performer_date_of_birth_from_custom_frame(mp3):151 metadata = container.load(mp3(TXXX_LEAD_PERFORMER_DATE_OF_BIRTH="2009-05-07"))152 assert_that(metadata, has_entry("lead_performer_date_of_birth", "2009-05-07"), "metadata")153def test_reads_production_company_from_custom_frame(mp3):154 metadata = container.load(mp3(TXXX_PRODUCTION_COMPANY="Effendi Records Inc."))155 assert_that(metadata, has_entry("production_company", "Effendi Records Inc."), "metadata")156def test_reads_production_company_region_from_custom_frame(mp3):157 metadata = container.load(mp3(TXXX_PRODUCTION_COMPANY_REGION="CA MTL"))158 assert_that(metadata, has_entry("production_company_region", ("CA", "MTL")), "metadata")159def test_reads_recording_studio_region_from_custom_frame(mp3):160 metadata = container.load(mp3(TXXX_RECORDING_STUDIO_REGION="CA MTL"))161 assert_that(metadata, has_entry("recording_studio_region", ("CA", "MTL")), "metadata")162def test_reads_recording_studio_address_from_custom_frame(mp3):163 metadata = container.load(mp3(TXXX_RECORDING_STUDIO_ADDRESS="2020 des zinzins, Montreal"))164 assert_that(metadata, has_entry("recording_studio_address", "2020 des zinzins, Montreal"), "metadata")165def test_round_trips_empty_metadata_to_file(mp3):166 assert_can_be_saved_and_reloaded_with_same_state(mp3, Metadata())167def test_round_trips_metadata_to_file(mp3):168 metadata = Metadata()169 metadata.addImage("image/jpeg", b"salers.jpg", Image.FRONT_COVER)170 metadata["release_name"] = "Album"171 metadata["compilation"] = True172 metadata["lead_performer"] = "Lead Performer"173 metadata["lead_performer_region"] = ("CA", "MTL")174 metadata["isnis"] = {"Lead Performer": "0000123456789",175 "Lyricist": "0000123456789"}176 metadata["ipis"] = {"Lyricist": "0000123456789"}177 metadata["iswc"] = "T-345246800-1"178 metadata["guest_performers"] = [("Guitar", "Guitarist"), ("Guitar", "Bassist"), ("Piano", "Pianist")]179 metadata["label_name"] = "Label Name"180 metadata["production_company"] = "Production Company"181 metadata["production_company_region"] = ("CA", "MTL")182 metadata["catalog_number"] = "123 456-1"183 metadata["upc"] = "987654321111"184 metadata["recording_time"] = "2012-07-01"185 metadata["release_time"] = "2013-12-01"186 metadata["original_release_time"] = "1999-01-01"187 metadata["recording_studio"] = "Studio Name"188 metadata["recording_studio_region"] = ("CA", "MTL")189 metadata["recording_studio_address"] = "2020 des zinzins, Montreal"190 metadata["music_producer"] = "Music Producer"191 metadata["mixer"] = "Mixing Engineer"192 metadata["contributors"] = [("recording", "Recording Eng."),193 ("mastering", "Mastering Eng."),194 ("recording", "Assistant Recording Eng.")]195 metadata["comments"] = "Comments"196 metadata["primary_style"] = "Jazz"197 metadata["track_title"] = "Track Title"198 metadata["version_info"] = "Version Info"199 metadata["featured_guest"] = "Featured Guest"200 metadata["lyricist"] = ["Lyricist"]201 metadata["composer"] = ["Composer"]202 metadata["publisher"] = ["Publisher"]203 metadata["isrc"] = "ZZXX87654321"204 metadata["labels"] = "Tag1 Tag2 Tag3"205 metadata["lyrics"] = "Lyrics"206 metadata["language"] = "fra"207 metadata["tagger"] = "TGiT"208 metadata["tagger_version"] = "1.0"209 metadata["tagging_time"] = "2014-03-26 18:18:55"210 metadata["track_number"] = 3211 metadata["total_tracks"] = 5212 assert_can_be_saved_and_reloaded_with_same_state(mp3, metadata)213def test_handles_unicode_metadata(mp3):214 metadata = Metadata()215 metadata["release_name"] = "Titre en Français"216 assert_can_be_saved_and_reloaded_with_same_state(mp3, metadata)217def test_removes_frame_when_tag_not_in_metadata(mp3):218 filename = mp3(TALB="Album",219 TMCL=[["Guitar", "Guitarist"]],220 TIPL=[["mix", "Mixing Engineer"]],221 USLT=("", "fra"))222 container.save(filename, Metadata())223 assert_contains_metadata(filename, Metadata())224def test_takes_none_as_absence_of_tag(mp3):225 filename = mp3()226 container.save(filename, Metadata(compilation=None))227 assert_contains_metadata(filename, Metadata())228def test_stores_several_pictures_sharing_the_same_description(mp3):229 filename = mp3()230 metadata = Metadata()231 metadata.addImage("image/jpeg", b"salers.jpg", desc="Front Cover")232 metadata.addImage("image/jpeg", b"ragber.jpg", desc="Front Cover")233 container.save(filename, metadata)234 assert_that(container.load(filename).images, contains_inanyorder(235 Image("image/jpeg", b"salers.jpg", type_=Image.OTHER, desc="Front Cover"),236 Image("image/jpeg", b"ragber.jpg", type_=Image.OTHER, desc="Front Cover (2)"),237 ))238def test_overwrites_existing_attached_pictures(mp3):239 filename = mp3(APIC_FRONT=("image/jpeg", "", b"front-cover.jpg"))240 metadata = Metadata()241 container.save(filename, metadata)242 assert_that(container.load(filename).images, has_length(0), "removed images")243 metadata.addImage(mime="image/jpeg", data=b"salers.jpg", desc="Front")244 container.save(filename, metadata)245 assert_that(container.load(filename).images, has_length(1), "updated images")246def test_transforms_deprecated_tagger_frame_into_tagger_and_version(mp3):247 metadata = container.load(mp3(TXXX_Tagger="TGiT v1.1"))248 assert_that(metadata, has_entries(tagger="TGiT", tagger_version="1.1"), "metadata")249def test_upgrades_deprecated_frames_to_their_new_form(mp3):250 metadata = container.load(mp3(TXXX_UPC="987654321111",251 TXXX_TAGGING_TIME="2014-03-26 14:18:55 -0400"))252 assert_that(metadata, has_entries(upc="987654321111", tagging_time="2014-03-26 18:18:55"), "metadata")253def test_upgrades_deprecated_isni_frames_to_its_new_form(mp3):254 metadata = container.load(mp3(TPE1="Joel Miller",255 TXXX_ISNI="0000000123456789"))256 assert_that(metadata, has_entries(lead_performer="Joel Miller",257 isnis=has_entry("Joel Miller", "0000000123456789")), "metadata")258def test_removes_old_isni_frames(mp3):259 filename = mp3(TXXX_ISNI_Joel_Miller="00000123456789",260 TXXX_ISNI_Rebecca_Ann_Maloy="98765432100000")261 container.save(filename, Metadata(isnis={"Joel Miller": "00000123456789"}))262 tags = MP3(filename)263 assert_that(tags, all_of(has_key("TXXX:ISNI:Joel Miller"),264 not_(has_key("TXXX:ISNI:Rebecca Ann Maloy"))), "tags in file")265def test_removes_old_ipi_frames(mp3):266 filename = mp3(TXXX_IPI_Joel_Miller="00000123456789",267 TXXX_IPI_Rebecca_Ann_Maloy="98765432100000")268 container.save(filename, Metadata(ipis={"Joel Miller": "00000123456789"}))269 tags = MP3(filename)270 assert_that(tags, all_of(has_key("TXXX:IPI:Joel Miller"),271 not_(has_key("TXXX:IPI:Rebecca Ann Maloy"))), "tags in file")...

Full Screen

Full Screen

test_flac_container.py

Source:test_flac_container.py Github

copy

Full Screen

...17 yield maker18 shutil.rmtree(tmpdir.strpath)19def test_reads_lead_performer_from_artists_field(flac):20 metadata = container.load(flac(ARTIST="Joel Miller"))21 assert_that(metadata, has_entry("lead_performer", "Joel Miller"), "metadata")22def test_reads_isni_under_structured_format(flac):23 metadata = container.load(flac(ISNI="0000000123456789:Joel Miller"))24 assert_that(metadata, has_entry("isnis", has_entry("Joel Miller", "0000000123456789")), "metadata")25def test_reads_isni_under_non_structured_format(flac):26 metadata = container.load(flac(ISNI="0000000123456789 (Joel Miller)"))27 assert_that(metadata, has_entry("isnis", has_entry("Joel Miller", "0000000123456789")), "metadata")28def test_reads_malformed_isni(flac):29 metadata = container.load(flac(ISNI="0000000123456789"))30 assert_that(metadata, has_entry("isnis", empty()), "metadata")31def test_reads_bitrate_from_audio_stream_information(flac):32 metadata = container.load(flac())33 assert_that(metadata, has_entry("bitrate", BITRATE), "bitrate")34def test_reads_duration_from_audio_stream_information(flac):35 metadata = container.load(flac())36 assert_that(metadata, has_entry("duration", DURATION), "duration")37def test_reads_track_title_from_title_field(flac):38 metadata = container.load(flac(TITLE="Salsa Coltrane"))39 assert_that(metadata, has_entry("track_title", "Salsa Coltrane"), "metadata")40def test_reads_release_name_from_album_field(flac):41 metadata = container.load(flac(ALBUM="Honeycomb"))42 assert_that(metadata, has_entry("release_name", "Honeycomb"), "metadata")43def test_reads_primary_style_from_genre_field(flac):44 metadata = container.load(flac(GENRE="Modern Jazz"))45 assert_that(metadata, has_entry("primary_style", "Modern Jazz"), "metadata")46def test_reads_track_isrc_from_isrc_field(flac):47 metadata = container.load(flac(ISRC="CABL31201254"))48 assert_that(metadata, has_entry("isrc", "CABL31201254"), "metadata")49def test_reads_track_iswc_from_iswc_field(flac):50 metadata = container.load(flac(ISWC="T-345246800-1"))51 assert_that(metadata, has_entry("iswc", "T-345246800-1"), "metadata")52def test_reads_recording_time_from_date_field(flac):53 metadata = container.load(flac(DATE="2011-11-02"))54 assert_that(metadata, has_entry("recording_time", "2011-11-02"), "metadata")55def test_reads_label_name_from_organization_field(flac):56 metadata = container.load(flac(ORGANIZATION="Effendi Records Inc."))57 assert_that(metadata, has_entry("label_name", "Effendi Records Inc."), "metadata")58def test_reads_attached_pictures_from_picture_field(flac):59 metadata = container.load(flac(PICTURES=(60 ("image/jpeg", PictureType.FRONT_COVER, "Front", b"front-cover.jpg"),61 ("image/jpeg", PictureType.BACK_COVER, "Back", b"back-cover.jpg"))))62 assert_that(metadata.images, contains_inanyorder(63 Image("image/jpeg", b"front-cover.jpg", type_=Image.FRONT_COVER, desc="Front"),64 Image("image/jpeg", b"back-cover.jpg", type_=Image.BACK_COVER, desc="Back"),65 ))66def test_reads_tagger_name_from_tagger_field(flac):67 metadata = container.load(flac(TAGGER="TGiT"))68 assert_that(metadata, has_entry("tagger", "TGiT"), "metadata")69def test_reads_tagger_version_from_tagger_version_field(flac):70 metadata = container.load(flac(TAGGER_VERSION="1.0"))71 assert_that(metadata, has_entry("tagger_version", "1.0"), "metadata")72def test_reads_tagging_time_from_tagging_time_field(flac):73 metadata = container.load(flac(TAGGING_TIME="2014-03-26 18:18:55"))74 assert_that(metadata, has_entry("tagging_time", "2014-03-26 18:18:55"), "metadata")75def test_reads_track_number_from_track_number_field(flac):76 metadata = container.load(flac(TRACKNUMBER="3"))77 assert_that(metadata, has_entry("track_number", 3), "metadata")78def test_reads_total_tracks_from_track_total_field(flac):79 metadata = container.load(flac(TRACKTOTAL="5"))80 assert_that(metadata, has_entry("total_tracks", 5), "metadata")81def test_reads_lead_performer_region_from_lead_performer_region_field(flac):82 metadata = container.load(flac(LEAD_PERFORMER_REGION="CA MTL"))83 assert_that(metadata, has_entry("lead_performer_region", ("CA", "MTL")), "metadata")84def test_reads_lead_performer_date_of_birth_from_lead_performer_date_of_birth_field(flac):85 metadata = container.load(flac(LEAD_PERFORMER_DATE_OF_BIRTH="2009-05-06"))86 assert_that(metadata, has_entry("lead_performer_date_of_birth", "2009-05-06"), "metadata")87def test_reads_lyricist(flac):88 metadata = container.load(flac(LYRICIST=["Joel Miller", "John Roney"]))89 assert_that(metadata, has_entry("lyricist", contains("Joel Miller", "John Roney")), "metadata")90def test_reads_production_company_from_producer_field(flac):91 metadata = container.load(flac(PRODUCER="Effendi Records Inc."))92 assert_that(metadata, has_entry("production_company", "Effendi Records Inc."), "metadata")93def test_reads_production_company_region_from_producer_region_field(flac):94 metadata = container.load(flac(PRODUCER_REGION="CA MTL"))95 assert_that(metadata, has_entry("production_company_region", ("CA", "MTL")), "metadata")96def test_reads_music_producer_from_music_producer_field(flac):97 metadata = container.load(flac(MUSIC_PRODUCER="Joel Miller & Paul Johnston"))98 assert_that(metadata, has_entry("music_producer", "Joel Miller & Paul Johnston"), "metadata")99def test_reads_recording_studio_from_recording_studio_field(flac):100 metadata = container.load(flac(RECORDING_STUDIO="Effendi Records Inc."))101 assert_that(metadata, has_entry("recording_studio", "Effendi Records Inc."), "metadata")102def test_reads_recording_studio_region_from_recording_studio_region_field(flac):103 metadata = container.load(flac(RECORDING_STUDIO_REGION="CA MTL"))104 assert_that(metadata, has_entry("recording_studio_region", ("CA", "MTL")), "metadata")105def test_reads_recording_studio_address_from_recording_studio_address_field(flac):106 metadata = container.load(flac(RECORDING_STUDIO_ADDRESS="2020 des zinzins, Montreal"))107 assert_that(metadata, has_entry("recording_studio_address", "2020 des zinzins, Montreal"), "metadata")108def test_reads_catalognumber_from_catalog_number_field(flac):109 metadata = container.load(flac(CATALOGNUMBER="001-002-003"))110 assert_that(metadata, has_entry("catalog_number", "001-002-003"), "metadata")111def test_reads_upc_from_barcode_field(flac):112 metadata = container.load(flac(BARCODE="123456789999"))113 assert_that(metadata, has_entry("upc", "123456789999"), "metadata")114def test_reads_mixer_from_mixer_field(flac):115 metadata = container.load(flac(MIXER="mr. mx"))116 assert_that(metadata, has_entry("mixer", "mr. mx"), "metadata")117def test_reads_comments_from_comment_field(flac):118 metadata = container.load(flac(COMMENT="Additional comments..."))119 assert_that(metadata, has_entry("comments", "Additional comments..."), "metadata")120def test_reads_publisher_from_publisher_field(flac):121 metadata = container.load(flac(PUBLISHER=["Publisher1", "Publisher2", "Publisher3"]))122 assert_that(metadata, has_entry("publisher", contains("Publisher1", "Publisher2", "Publisher3")), "metadata")123def test_reads_composer_from_composer_field(flac):124 metadata = container.load(flac(COMPOSER=["Composer1", "Composer2", "Composer3"]))125 assert_that(metadata, has_entry("composer", contains("Composer1", "Composer2", "Composer3")), "metadata")126def test_reads_version_information_from_version_field(flac):127 metadata = container.load(flac(VERSION="to differentiate the track"))128 assert_that(metadata, has_entry("version_info", "to differentiate the track"), "metadata")129def test_reads_lyrics_from_lyrics_field(flac):130 metadata = container.load(flac(LYRICS="lyrics of the track"))131 assert_that(metadata, has_entry("lyrics", "lyrics of the track"), "metadata")132def test_reads_language_from_language_field(flac):133 metadata = container.load(flac(LANGUAGE="language of the lyrics"))134 assert_that(metadata, has_entry("language", "language of the lyrics"), "metadata")135def test_reads_compilation_flag_from_compilation_field(flac):136 metadata = container.load(flac(COMPILATION="YES"))137 assert_that(metadata, has_entry("compilation", True), "metadata")138 metadata = container.load(flac(COMPILATION="NO"))139 assert_that(metadata, has_entry("compilation", False), "metadata")140def test_reads_guest_performer_from_guest_artist_field(flac):141 metadata = container.load(flac(GUEST_ARTIST="collaborating artist"))142 assert_that(metadata, has_entry("featured_guest", "collaborating artist"), "metadata")143def test_reads_tags_from_tags_field(flac):144 metadata = container.load(flac(TAG=["tag1", "tag2", "tag3"]))145 assert_that(metadata, has_entry("labels", "tag1, tag2, tag3"), "metadata")146def test_reads_release_time_from_release_date_field(flac):147 metadata = container.load(flac(RELEASE_DATE="2008-03-01"))148 assert_that(metadata, has_entry("release_time", "2008-03-01"), "metadata")149def test_reads_guest_performers_from_performer_field(flac):150 metadata = container.load(flac(PERFORMER=["Guitarist (guitar)", "Bassist (guitar)", "Pianist (piano)"]))151 assert_that(metadata, has_entry("guest_performers", contains_inanyorder(152 ("guitar", "Guitarist"),153 ("guitar", "Bassist"),154 ("piano", "Pianist"))), "metadata")155def test_round_trips_metadata_to_file(flac):156 metadata = Metadata()157 metadata.addImage("image/jpeg", b"honeycomb.jpg", Image.FRONT_COVER)158 metadata["release_name"] = "St-Henri"159 metadata["lead_performer"] = "Joel Miller"160 metadata["lead_performer_region"] = ("CA", "MTL")161 metadata["isnis"] = {"Joel Miller": "0000000123456789", "Rebecca Ann Maloy": "9876543210000000"}162 metadata["ipis"] = {"Joel Miller": "0000000123456789", "Rebecca Ann Maloy": "9876543210000000"}163 metadata["label_name"] = "Effendi Records Inc."164 metadata["primary_style"] = "Modern Jazz"165 metadata["recording_time"] = "2007-11-02"...

Full Screen

Full Screen

test_yaml.py

Source:test_yaml.py Github

copy

Full Screen

...73 assert_that(lines, has_item(contains_string("- 2nd")), "2nd track")74 assert_that(lines, has_item(contains_string("- 3rd")), "3rd track")75def test_reads_data_from_yaml_file():76 data = yaml.read_data(resources.path("album.tgit"))77 assert_that(data, has_entry("version", "1.11.0"), "version")78 assert_that(data, has_entry("type", "mp3"), "album type")79 assert_that(data, has_entry("release_name", "Title"), "release name")80 assert_that(data, has_entry("compilation", True), "compilation")81 assert_that(data, has_entry("lead_performer", equal_to("Artist")), "lead performer")82 assert_that(data, has_entry("lead_performer_region", ("FR",)), "lead performer region")83 assert_that(data, has_entry("isnis", has_entry("Artist", "0000000123456789")), "isnis")84 assert_that(data, has_entry("guest_performers", contains(("Guitar", "Guitarist"), ("Piano", "Pianist"))),85 "guest performers")86 assert_that(data, has_entry("label_name", "Label"), "label name")87 assert_that(data, has_entry("catalog_number", "XXX123456789"), "catalog number")88 assert_that(data, has_entry("upc", "123456789999"), "upc")89 assert_that(data, has_entry("comments", "Comments\n..."), "comments")90 assert_that(data, has_entry("release_time", "2009-01-01"), "release time")91 assert_that(data, has_entry("recording_time", "2008-09-15"), "recording time")92 assert_that(data, has_entry("original_release_time", "2009-01-15"), "original_release time")93 assert_that(data, has_entry("contributors", contains(("Sound", "Sound Engineer"), ("Effects", "Effects Engineer"))),94 "contributors")95 assert_that(data, has_entry("images", contains(("image/jpeg", "Front.jpeg", Image.FRONT_COVER, "Front"))),96 "attached pictures")97 assert_that(data, has_entry("tracks", contains("1st", "2nd", "3rd")))98def test_writes_unicode_strings_in_yaml_file(project_file):99 album_file = project_file("album.tgit")100 data = dict(entry="Les naïfs ægithales hâtifs pondant à Noël...")101 yaml.write_data(album_file, data)102 lines = read_lines(album_file)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Lemoncheesecake automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful