mirror of
https://github.com/beetbox/beets.git
synced 2026-01-04 23:12:51 +01:00
add test_lastgenre.py
This commit is contained in:
parent
fea5df2339
commit
3d30708839
1 changed files with 44 additions and 0 deletions
44
test/test_lastgenre.py
Normal file
44
test/test_lastgenre.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# This file is part of beets.
|
||||
# Copyright 2014, Fabrice Laporte.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
"""Tests for the 'lastgenre' plugin."""
|
||||
|
||||
from _common import unittest
|
||||
from beetsplug import lastgenre
|
||||
from beets import config
|
||||
|
||||
class LastGenrePluginTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
"""Set up configuration"""
|
||||
lyrics.LastGenrePlugin()
|
||||
|
||||
def _setup_config(self, whitelist=set(), branches=None, count=1):
|
||||
config['lastgenre']['whitelist'] = whitelist
|
||||
if branches:
|
||||
config['lastgenre']['branches'] = branches
|
||||
config['lastgenre']['c14n'] = True
|
||||
else:
|
||||
config['lastgenre']['c14n'] = False
|
||||
config['lastgenre']['count'] = count
|
||||
|
||||
def test_c14n():
|
||||
_setup_config(set('blues'),
|
||||
[['blues'],
|
||||
['blues', 'country blues'],
|
||||
['blues', 'country blues', 'delta blues']])
|
||||
|
||||
self.assertEqual(lastgenre._strings_to_genre(['delta blues']),
|
||||
'blues')
|
||||
|
||||
|
||||
Loading…
Reference in a new issue