def test_add(self): song = AudioFile() self.failIf("foo" in song) song.add("foo", "bar") self.failUnlessEqual(song["foo"], "bar") song.add("foo", "another") self.failUnlessEqual(song.list("foo"), ["bar", "another"])
def test_change(self): song = AudioFile() song.add("foo", "bar") song.add("foo", "another") song.change("foo", "bar", "one more") self.failUnlessEqual(song.list("foo"), ["one more", "another"]) song.change("foo", "does not exist", "finally") self.failUnlessEqual(song["foo"], "finally") song.change("foo", "finally", "we're done") self.failUnlessEqual(song["foo"], "we're done")
def test_remove_all(self): song = AudioFile() song.add("foo", "bar") song.add("foo", "another") song.add("foo", "one more") song.remove("foo") self.assertFalse("foo" in song)
def test_remove(self): song = AudioFile() song.add("foo", "bar") song.add("foo", "another") song.add("foo", "one more") song.remove("foo", "another") self.failUnlessEqual(song.list("foo"), ["bar", "one more"]) song.remove("foo", "bar") self.failUnlessEqual(song.list("foo"), ["one more"]) song.remove("foo", "one more") self.failIf("foo" in song)
def test_remove_empty(self): song = AudioFile() song.add("foo", u"") song.remove("foo", u"") self.assertFalse("foo" in song)
def test_remove_unknown(self): song = AudioFile() song.add("foo", "bar") song.remove("foo", "not in list") song.remove("nope") self.failUnlessEqual(song.list("foo"), ["bar"])