# Path: chirp/library/album.py
# class AlbumError(Exception):
# class Album(object):
# def _compute_album_id(all_au_files):
# def _standardize_tags(all_au_files, new_album_name=None):
#     def __init__(self, all_au_files):
#     def _sort(self):
#     def standardize(self, new_album_name=None):
#     def set_volume_and_import_timestamp(self, vol, imp_ts):
#     def drop_payloads(self):
#     def ensure_payloads(self):
#     def title(self):
#     def tags(self):
#     def _get_tpe1_breakdown(self):
#     def is_compilation(self):
#     def artist_name(self):
#     def all_artist_names():
#     def import_timestamp(self):
#     def __str__(self):
# def from_directory(dirpath, fast=False):
# 
# Path: chirp/library/audio_file.py
# class AudioFile(object):
#     def __eq__(self, other):
#         def _mutagen_id3_set(obj):
#     def has_ufid(self):
#     def ufid(self):
#     def ufid_tag(self):
#     def tpe1(self):
#     def talb(self):
#     def tit2(self):
#     def canonical_directory(self, prefix=""):
#     def canonical_filename(self):
#     def canonical_path(self, prefix=""):
# def _get_mp3(path):
# def _tag_to_int(au_file, tag_key):
# def scan_fast(path, _read_id3_hook=None):
# def scan(path, _read_id3_hook=None):


import unittest
import mutagen.id3
from chirp.library import album
from chirp.library import audio_file
    def test_standardize_tags(self):
        test_alb = self.create_test_album(4)
        album._standardize_tags(test_alb)
        # Check that nothing chaged.
        self.assertEqual(
            [repr(x.mutagen_id3) for x in self.create_test_album(4)],
            [repr(x.mutagen_id3) for x in test_alb])
        
        # Check that the album ID got attached.
        expected_id = album._compute_album_id(test_alb)
        for au_file in test_alb:
            self.assertEqual(expected_id, au_file.album_id)

        # Check that we correctly split the artist name.
        test_alb[2].mutagen_id3["TPE1"].text = ["The Fall ft. T-Pain"]
        album._standardize_tags(test_alb)
        self.assertEqual("The Fall",
                         unicode(test_alb[2].mutagen_id3["TPE1"]))
        self.assertEqual(u"TIT2 (w/ T-Pain) [Tag]",
                         unicode(test_alb[2].mutagen_id3["TIT2"]))

        # Check that we can change the album name using our optional
        # arg.
        album._standardize_tags(test_alb, new_album_name="New Name")
        for au_file in test_alb:
            self.assertEqual("New Name",
                             unicode(au_file.mutagen_id3["TALB"]))

        # Check that the import fails if the album is named inconsistently.
        test_alb[1].mutagen_id3["TALB"].text = ["Some other album name"]

# Path: chirp/library/album.py
# class AlbumError(Exception):
# class Album(object):
# def _compute_album_id(all_au_files):
# def _standardize_tags(all_au_files, new_album_name=None):
#     def __init__(self, all_au_files):
#     def _sort(self):
#     def standardize(self, new_album_name=None):
#     def set_volume_and_import_timestamp(self, vol, imp_ts):
#     def drop_payloads(self):
#     def ensure_payloads(self):
#     def title(self):
#     def tags(self):
#     def _get_tpe1_breakdown(self):
#     def is_compilation(self):
#     def artist_name(self):
#     def all_artist_names():
#     def import_timestamp(self):
#     def __str__(self):
# def from_directory(dirpath, fast=False):
# 
# Path: chirp/library/audio_file.py
# class AudioFile(object):
#     def __eq__(self, other):
#         def _mutagen_id3_set(obj):
#     def has_ufid(self):
#     def ufid(self):
#     def ufid_tag(self):
#     def tpe1(self):
#     def talb(self):
#     def tit2(self):
#     def canonical_directory(self, prefix=""):
#     def canonical_filename(self):
#     def canonical_path(self, prefix=""):
# def _get_mp3(path):
# def _tag_to_int(au_file, tag_key):
# def scan_fast(path, _read_id3_hook=None):
# def scan(path, _read_id3_hook=None):


# Path: chirp/library/album_test.py
import unittest
import mutagen.id3
from chirp.library import album
from chirp.library import audio_file

    def test_standardize_tags(self):
        test_alb = self.create_test_album(4)
        album._standardize_tags(test_alb)
        # Check that nothing chaged.
        self.assertEqual(
            [repr(x.mutagen_id3) for x in self.create_test_album(4)],
            [repr(x.mutagen_id3) for x in test_alb])
        
        # Check that the album ID got attached.
        expected_id = album._compute_album_id(test_alb)
        for au_file in test_alb:
            self.assertEqual(expected_id, au_file.album_id)

        # Check that we correctly split the artist name.
        test_alb[2].mutagen_id3["TPE1"].text = ["The Fall ft. T-Pain"]
        album._standardize_tags(test_alb)
        self.assertEqual("The Fall",
                         unicode(test_alb[2].mutagen_id3["TPE1"]))
        self.assertEqual(u"TIT2 (w/ T-Pain) [Tag]",
                         unicode(test_alb[2].mutagen_id3["TIT2"]))

        # Check that we can change the album name using our optional
        # arg.
        album._standardize_tags(test_alb, new_album_name="New Name")
        for au_file in test_alb:
            self.assertEqual("New Name",
                             unicode(au_file.mutagen_id3["TALB"]))

        # Check that the import fails if the album is named inconsistently.
        test_alb[1].mutagen_id3["TALB"].text = ["Some other album name"]

        self.assertRaises(album.AlbumError,