Skip to content

Commit

Permalink
py27 "fixes"
Browse files Browse the repository at this point in the history
  • Loading branch information
nicfit committed Mar 28, 2018
1 parent 77066ab commit e01d4e4
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions src/test/id3/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,45 +1199,49 @@ def testIssue76(audiofile):
https://github.com/nicfit/eyeD3/issues/76
"""
tag = audiofile.initTag(ID3_V2_4)
tag.setTextFrame("TPE1", "Confederacy of Ruined Lives")
tag.setTextFrame("TPE2", "Take as needed for pain")
tag.setTextFrame("TSOP", "In the name of suffering")
tag.setTextFrame("TSO2", "Dope sick")
tag.setTextFrame("TPE1", u"Confederacy of Ruined Lives")
tag.setTextFrame("TPE2", u"Take as needed for pain")
tag.setTextFrame("TSOP", u"In the name of suffering")
tag.setTextFrame("TSO2", u"Dope sick")
tag.save()

audiofile = eyed3.load(audiofile.path)
tag = audiofile.tag
assert set(tag.frame_set.keys()) == {b"TPE1", b"TPE2", b"TSOP", b"TSO2"}
assert tag.getTextFrame("TSO2") == "Dope sick"
assert tag.getTextFrame("TSOP") == "In the name of suffering"
assert tag.getTextFrame("TPE2") == "Take as needed for pain"
assert tag.getTextFrame("TPE1") == "Confederacy of Ruined Lives"

audiofile.tag.lyrics.set("some lyrics")
assert (set(tag.frame_set.keys()) ==
set([b"TPE1", b"TPE2", b"TSOP", b"TSO2"]))
assert tag.getTextFrame("TSO2") == u"Dope sick"
assert tag.getTextFrame("TSOP") == u"In the name of suffering"
assert tag.getTextFrame("TPE2") == u"Take as needed for pain"
assert tag.getTextFrame("TPE1") == u"Confederacy of Ruined Lives"

audiofile.tag.lyrics.set(u"some lyrics")
audiofile = eyed3.load(audiofile.path)
tag = audiofile.tag
assert set(tag.frame_set.keys()) == {b"TPE1", b"TPE2", b"TSOP", b"TSO2"}
assert tag.getTextFrame("TSO2") == "Dope sick"
assert tag.getTextFrame("TSOP") == "In the name of suffering"
assert tag.getTextFrame("TPE2") == "Take as needed for pain"
assert tag.getTextFrame("TPE1") == "Confederacy of Ruined Lives"
assert (set(tag.frame_set.keys()) ==
set([b"TPE1", b"TPE2", b"TSOP", b"TSO2"]))
assert tag.getTextFrame("TSO2") == u"Dope sick"
assert tag.getTextFrame("TSOP") == u"In the name of suffering"
assert tag.getTextFrame("TPE2") == u"Take as needed for pain"
assert tag.getTextFrame("TPE1") == u"Confederacy of Ruined Lives"

# Convert to v2.3 and verify conversions
tag.save(version=ID3_V2_3)
audiofile = eyed3.load(audiofile.path)
tag = audiofile.tag
assert set(tag.frame_set.keys()) == {b"TPE1", b"TPE2", b"XSOP", b"TSO2"}
assert tag.getTextFrame("TSO2") == "Dope sick"
assert tag.getTextFrame("TPE2") == "Take as needed for pain"
assert tag.getTextFrame("TPE1") == "Confederacy of Ruined Lives"
assert (set(tag.frame_set.keys()) ==
set([b"TPE1", b"TPE2", b"XSOP", b"TSO2"]))
assert tag.getTextFrame("TSO2") == u"Dope sick"
assert tag.getTextFrame("TPE2") == u"Take as needed for pain"
assert tag.getTextFrame("TPE1") == u"Confederacy of Ruined Lives"
assert tag.frame_set[b"XSOP"][0].text == "In the name of suffering"

# Convert to v2.4 and verify conversions
tag.save(version=ID3_V2_4)
audiofile = eyed3.load(audiofile.path)
tag = audiofile.tag
assert set(tag.frame_set.keys()) == {b"TPE1", b"TPE2", b"TSOP", b"TSO2"}
assert tag.getTextFrame("TSO2") == "Dope sick"
assert tag.getTextFrame("TPE2") == "Take as needed for pain"
assert tag.getTextFrame("TPE1") == "Confederacy of Ruined Lives"
assert tag.getTextFrame("TSOP") == "In the name of suffering"
assert (set(tag.frame_set.keys()) ==
set([b"TPE1", b"TPE2", b"TSOP", b"TSO2"]))
assert tag.getTextFrame("TSO2") == u"Dope sick"
assert tag.getTextFrame("TPE2") == u"Take as needed for pain"
assert tag.getTextFrame("TPE1") == u"Confederacy of Ruined Lives"
assert tag.getTextFrame("TSOP") == u"In the name of suffering"

0 comments on commit e01d4e4

Please sign in to comment.