コード例 #1
0
ファイル: test_library.py プロジェクト: ykumar6/beets
 def test_get_formatted_datetime(self):
     with _common.platform_posix():
         self.i.added = 1368302461.210265
         val = self.i.formatted().get('added')
     self.assertTrue(val.startswith('2013'))
コード例 #2
0
ファイル: test_library.py プロジェクト: ykumar6/beets
 def test_get_formatted_does_not_replace_separators(self):
     with _common.platform_posix():
         name = os.path.join('a', 'b')
         self.i.title = name
         newname = self.i.formatted().get('title')
     self.assertEqual(name, newname)
コード例 #3
0
ファイル: test_library.py プロジェクト: ykumar6/beets
 def test_get_formatted_uses_kbps_bitrate(self):
     with _common.platform_posix():
         self.i.bitrate = 12345
         val = self.i.formatted().get('bitrate')
     self.assertEqual(val, u'12kbps')
コード例 #4
0
ファイル: test_library.py プロジェクト: pprkut/beets
 def test_get_formatted_datetime(self):
     with _common.platform_posix():
         self.i.added = 1368302461.210265
         val = self.i.formatted().get('added')
     self.assertTrue(val.startswith('2013'))
コード例 #5
0
ファイル: test_library.py プロジェクト: pprkut/beets
 def _assert_dest(self, dest, i=None):
     if i is None:
         i = self.i
     with _common.platform_posix():
         actual = i.destination()
     self.assertEqual(actual, dest)
コード例 #6
0
ファイル: test_library.py プロジェクト: pprkut/beets
 def test_get_formatted_does_not_replace_separators(self):
     with _common.platform_posix():
         name = os.path.join('a', 'b')
         self.i.title = name
         newname = self.i.formatted().get('title')
     self.assertEqual(name, newname)
コード例 #7
0
ファイル: test_library.py プロジェクト: pprkut/beets
 def test_get_formatted_uses_kbps_bitrate(self):
     with _common.platform_posix():
         self.i.bitrate = 12345
         val = self.i.formatted().get('bitrate')
     self.assertEqual(val, u'12kbps')
コード例 #8
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_sanitize_with_custom_replace_adds_replacements(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'foo/bar', [
             (re.compile(r'foo'), u'bar'),
         ])
     self.assertEqual(p, u'bar/bar')
コード例 #9
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_sanitize_empty_component(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'foo//bar', [
             (re.compile(r'^$'), u'_'),
         ])
     self.assertEqual(p, u'foo/_/bar')
コード例 #10
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_sanitize_path_works_on_empty_string(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'')
     self.assertEqual(p, u'')
コード例 #11
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_sanitize_with_custom_replace_overrides_built_in_sub(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'a/.?/b', [
             (re.compile(r'foo'), u'bar'),
         ])
     self.assertEqual(p, u'a/.?/b')
コード例 #12
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_sanitize_unix_replaces_leading_dot(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'one/.two/three')
     self.assertFalse(u'.' in p)
コード例 #13
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_truncate_preserves_extension(self):
     with _common.platform_posix():
         p = util.truncate_path(u'abcde/fgh.ext', 5)
     self.assertEqual(p, u'abcde/f.ext')
コード例 #14
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_truncate_unicode(self):
     with _common.platform_posix():
         p = util.truncate_path(u'abcde/fgh', 4)
     self.assertEqual(p, u'abcd/fgh')
コード例 #15
0
ファイル: test_library.py プロジェクト: ykumar6/beets
 def _assert_dest(self, dest, i=None):
     if i is None:
         i = self.i
     with _common.platform_posix():
         actual = i.destination()
     self.assertEqual(actual, dest)
コード例 #16
0
 def test_syspath_posix_unchanged(self):
     with _common.platform_posix():
         path = os.path.join(u'a', u'b', u'c')
         outpath = util.syspath(path)
     self.assertEqual(path, outpath)
コード例 #17
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_truncate_bytestring(self):
     with _common.platform_posix():
         p = util.truncate_path(b'abcde/fgh', 4)
     self.assertEqual(p, b'abcd/fgh')
コード例 #18
0
 def test_truncate_bytestring(self):
     with _common.platform_posix():
         p = util.truncate_path(b'abcde/fgh', 4)
     self.assertEqual(p, b'abcd/fgh')
コード例 #19
0
ファイル: test_library.py プロジェクト: pprkut/beets
 def test_get_formatted_pads_with_zero(self):
     with _common.platform_posix():
         self.i.track = 1
         name = self.i.formatted().get('track')
     self.assertTrue(name.startswith('0'))
コード例 #20
0
 def test_truncate_unicode(self):
     with _common.platform_posix():
         p = util.truncate_path(u'abcde/fgh', 4)
     self.assertEqual(p, u'abcd/fgh')
コード例 #21
0
ファイル: test_library.py プロジェクト: pprkut/beets
 def test_get_formatted_uses_khz_samplerate(self):
     with _common.platform_posix():
         self.i.samplerate = 12345
         val = self.i.formatted().get('samplerate')
     self.assertEqual(val, u'12kHz')
コード例 #22
0
 def test_truncate_preserves_extension(self):
     with _common.platform_posix():
         p = util.truncate_path(u'abcde/fgh.ext', 5)
     self.assertEqual(p, u'abcde/f.ext')
コード例 #23
0
ファイル: test_library.py プロジェクト: pprkut/beets
 def test_get_formatted_none(self):
     with _common.platform_posix():
         self.i.some_other_field = None
         val = self.i.formatted().get('some_other_field')
     self.assertEqual(val, u'')
コード例 #24
0
 def test_sanitize_unix_replaces_leading_dot(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'one/.two/three')
     self.assertFalse(u'.' in p)
コード例 #25
0
ファイル: test_library.py プロジェクト: pprkut/beets
 def _assert_dest(self, dest):
     with _common.platform_posix():
         the_dest = self.i.destination()
     self.assertEqual(the_dest, b'/base/' + dest)
コード例 #26
0
 def test_sanitize_path_works_on_empty_string(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'')
     self.assertEqual(p, u'')
コード例 #27
0
ファイル: test_library.py プロジェクト: ykumar6/beets
 def test_get_formatted_pads_with_zero(self):
     with _common.platform_posix():
         self.i.track = 1
         name = self.i.formatted().get('track')
     self.assertTrue(name.startswith('0'))
コード例 #28
0
 def test_sanitize_with_custom_replace_overrides_built_in_sub(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'a/.?/b', [
             (re.compile(r'foo'), u'bar'),
         ])
     self.assertEqual(p, u'a/.?/b')
コード例 #29
0
ファイル: test_library.py プロジェクト: ykumar6/beets
 def test_get_formatted_uses_khz_samplerate(self):
     with _common.platform_posix():
         self.i.samplerate = 12345
         val = self.i.formatted().get('samplerate')
     self.assertEqual(val, u'12kHz')
コード例 #30
0
 def test_sanitize_with_custom_replace_adds_replacements(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'foo/bar', [
             (re.compile(r'foo'), u'bar'),
         ])
     self.assertEqual(p, u'bar/bar')
コード例 #31
0
ファイル: test_library.py プロジェクト: ykumar6/beets
 def test_get_formatted_none(self):
     with _common.platform_posix():
         self.i.some_other_field = None
         val = self.i.formatted().get('some_other_field')
     self.assertEqual(val, u'')
コード例 #32
0
 def test_sanitize_empty_component(self):
     with _common.platform_posix():
         p = util.sanitize_path(u'foo//bar', [
             (re.compile(r'^$'), u'_'),
         ])
     self.assertEqual(p, u'foo/_/bar')
コード例 #33
0
ファイル: test_library.py プロジェクト: ykumar6/beets
 def _assert_dest(self, dest):
     with _common.platform_posix():
         the_dest = self.i.destination()
     self.assertEqual(the_dest, '/base/' + dest)
コード例 #34
0
ファイル: test_util.py プロジェクト: JDLH/beets
 def test_syspath_posix_unchanged(self):
     with _common.platform_posix():
         path = os.path.join(u'a', u'b', u'c')
         outpath = util.syspath(path)
     self.assertEqual(path, outpath)