mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
moved test to other file
moved the tests of ui/__init__ to a new test file
This commit is contained in:
parent
f246a71e7b
commit
40ec848133
2 changed files with 58 additions and 26 deletions
|
|
@ -113,32 +113,6 @@ class FieldsTest(_common.LibTestCase):
|
|||
self.assertEqual(len(albums), 0)
|
||||
|
||||
|
||||
class InitTest(_common.LibTestCase):
|
||||
def setUp(self):
|
||||
super(InitTest, self).setUp()
|
||||
|
||||
self.io.install()
|
||||
|
||||
def tearDown(self):
|
||||
self.io.restore()
|
||||
|
||||
def test_human_seconds(self):
|
||||
tests = [
|
||||
(0, '0.0 seconds'),
|
||||
(30, '30.0 seconds'),
|
||||
(60, '1.0 minutes'),
|
||||
(90, '1.5 minutes'),
|
||||
(125, '2.1 minutes'),
|
||||
(3600, '1.0 hours'),
|
||||
(86400, '1.0 days'),
|
||||
(604800, '1.0 weeks'),
|
||||
(31449600, '1.0 years'),
|
||||
(314496000, '1.0 decades'),
|
||||
]
|
||||
for i, h in tests:
|
||||
self.assertEqual(h, ui.human_seconds(i))
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
|
|
|
|||
58
test/test_ui_init.py
Normal file
58
test/test_ui_init.py
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# -*- coding: utf8 -*-
|
||||
# This file is part of beets.
|
||||
# Copyright 2015, Adrian Sampson.
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""Test module for file ui/__init__.py
|
||||
"""
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from test import _common
|
||||
from test._common import unittest
|
||||
|
||||
from beets import library
|
||||
from beets import ui
|
||||
|
||||
|
||||
class InitTest(_common.LibTestCase):
|
||||
def setUp(self):
|
||||
super(InitTest, self).setUp()
|
||||
|
||||
self.io.install()
|
||||
|
||||
def tearDown(self):
|
||||
self.io.restore()
|
||||
|
||||
def test_human_seconds(self):
|
||||
tests = [
|
||||
(0, '0.0 seconds'),
|
||||
(30, '30.0 seconds'),
|
||||
(60, '1.0 minutes'),
|
||||
(90, '1.5 minutes'),
|
||||
(125, '2.1 minutes'),
|
||||
(3600, '1.0 hours'),
|
||||
(86400, '1.0 days'),
|
||||
(604800, '1.0 weeks'),
|
||||
(31449600, '1.0 years'),
|
||||
(314496000, '1.0 decades'),
|
||||
]
|
||||
for i, h in tests:
|
||||
self.assertEqual(h, ui.human_seconds(i))
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
if __name__ == b'__main__':
|
||||
unittest.main(defaultTest='suite')
|
||||
Loading…
Reference in a new issue