Commit graph

101 commits

Author SHA1 Message Date
Kirill A. Korinsky
c459ff26fb
Prevent fails of tests when path contains dots
Unit test may fails when path to temprorary library contains `.`; to
garantue that bug wasn't here, it forces to use one more `.` inside path.

Fixes: https://github.com/beetbox/beets/issues/4151
2021-11-19 16:54:28 +01:00
Julien Cassette
b67c25a55d Use slow queries for flexible attributes in aunique (fix #2678, close #3553) 2021-11-11 19:32:55 +01:00
Christopher Larson
86465e6437 Allow custom replacements in Item.destination
This allows for the use of differing replacements for destinations other than
the library, which is useful for beets-alternatives in the case where
filesystem requirements differ between the two paths.

Signed-off-by: Christopher Larson <kergoth@gmail.com>
2021-10-27 12:30:16 -07:00
Andrew Rogl
ee4268dabb Remove unused imports
Fix imports
Fix formatting
2021-08-26 20:59:48 +10:00
Andrew Rogl
1ec87a3bdd pyupgrade beetsplug and tests
All tests working
More tidy up to be done
2021-08-26 19:12:51 +10:00
FichteFoll
72515448ad
Add fallback for item access to album's attributes
Allows queries (especially for pathspecs) based on an album's flexattrs
while operating on items.

Fixes #2797.
2019-06-05 02:38:46 +02:00
Carl Suster
546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Guilherme Danno
fa1037ee28
Enhance %title (#3059)
Use string.capwords in %title to lower char after apostrophe
2018-11-29 11:30:48 -02:00
Jack Wilsdon
5ad16983d4
Fix miscellaneous typos 2018-10-09 01:11:06 +01:00
Adrian Sampson
9577a511cb Update tests for new Unidecode behavior: fix #2799
The library has started putting spaces around the expanded versions of
vulgar fraction characters.
2018-01-30 20:50:43 -05:00
diomekes
04f7915d41 change no-bracket argument from white space to empty 2017-01-20 22:47:47 -05:00
diomekes
eaa2161a90 fix empty disambig string test 2017-01-20 19:40:09 -05:00
diomekes
d10df34c65 add test for aunique without brackets 2017-01-20 09:06:38 -05:00
diomekes
3a967df396 simplify check for empty disam_val, update changelog and docs, add change bracket test 2017-01-19 20:41:44 -05:00
diomekes
377a2a6964 add bracket argument to aunique 2017-01-19 20:39:12 -05:00
Adrian Sampson
4bbb05b009 Merge pull request #2303 from tweitzel/master
Decompose unicode paths and unidecode each component. Fixes #1087 #1159 #1541 #2286
2016-12-08 21:35:01 -05:00
xarph
53a677b8fd * break the asciify-paths code out into the util.asciify_paths function
* make asciifying handle both os.sep and os.altsep (testing needed as I
  don't have a windows box handy)
* make %asciify{} use the same code path as the asciify_paths goop.
* added a discrete test to %asciify{} so my life acts as a warning to
  others
* changelog note now with 80% less antihistamine-induced runon sentences
2016-12-07 20:59:33 -08:00
xarph
4461835cda sampsyo's better test of unicode path escaping
revert my lame test
2016-12-05 22:03:00 -08:00
Adrian Sampson
ae5e55cad6 Always use syspath to construct MediaFile
Related to #1966. Previously, we used a `syspath` call inside MediaFile, which
probably wasn't right: the constructor should behave like `open` in that we
need to use pass an OS path.
2016-12-04 21:00:56 -05:00
xarph
87942af4c4 fix line wrapping for py34-flake8 2016-12-03 16:15:40 -08:00
xarph
edd34267c6 modify DestinationTest.test_asciify_and_replace to include unicode
titles that decode to path separator.

Added an empty .mp3 file with problematic characters for asciify_paths
in id3v2 tags for future tests if needed.
2016-12-03 15:29:27 -08:00
Adrian Sampson
a88682e7bb Undo from _common import unittest indirection
This was a vestige from when we used to need the unittest2 library for pre-2.7
compatibility. Now that we require Python 2.7, we aren't using that library
and this indirection wasn't doing any good.
2016-11-26 18:46:44 -05:00
Adrian Sampson
15a5512ea5 Require Unicode format strings
Fallout from #2188. Following @jrobeson's suggestion, I just turned the check
in LibModel.__format__ into an assert. This turned up a few badly-behaved
clients, which are also fixed.
2016-09-07 21:42:59 -04:00
Johnny Robeson
7a2bdf502f s/utf8/utf-8/ in all encoding/decoding contexts
This matches up with the python documentation.
2016-09-06 23:10:24 -04:00
Johnny Robeson
632240c01c s/linux2/linux/ as platform name in test_library
This causes no issues for us now, and is more forward compatible.
2016-09-05 22:57:38 -04:00
Adrian Sampson
6919d6980f Fix path types in test_unicode_path
This is lifted directly from 658e814ad718610004cbe6d865c8f2f62e676ffb.
2016-07-01 21:54:37 -07:00
Adrian Sampson
5efd5b21c5 Use new as_str method
Instead of `get(six.text_type)`, which was a surprisingly large portion of our
uses of six.
2016-06-25 19:16:14 -07:00
Johnny Robeson
e8afcbe7ec replace unicode with six.text_type 2016-06-24 05:53:49 -04:00
Johnny Robeson
3184599faa compare bytes to bytes in library TemplateTest 2016-06-16 23:18:24 -04:00
Johnny Robeson
ffa46a185c bytestring normalization
Make sure many/most strings that touch the filesystem are
converted explicitly to bytestrings rather than implictly.
2016-06-13 05:39:09 -04:00
Johnny Robeson
6c969ae58c remove some incorrect displayable_path in library tests
These were noticed by @sampsyo in the review of
daac41668e
2016-06-11 21:29:17 -04:00
Johnny Robeson
fff1458a9e introduce PATH_SEP attr to beets.util
This is needed for various path tests that expect to operate on
bytestrings
2016-06-11 21:26:23 -04:00
Johnny Robeson
daac41668e use util.displayable_path in more tests 2016-06-10 03:54:39 -04:00
Adrian Sampson
8bf1f868fa Fix comparison in a library type test 2016-06-06 11:46:51 -07:00
Johnny Robeson
cd1f79340f remove explicit b' from sql query dict key names 2016-05-30 18:50:11 -04:00
Adrian Sampson
71b9fd785c Revert "Do __name__ comparison with bytes and not unicode"
This reverts commit 9c41c39913.
That commit used byte strings for the `if __name__ == '__main__'` pattern,
which was necessary when we were doing unicode_literals. But it is wrong on
Python 3, and now that we're liberated from unicode_literals, we need to go
back to native strings for this comparison.
2016-05-29 19:19:59 -07:00
Johnny Robeson
a37a52633b replace deprecated assertNotEquals() with assertNotEqual() 2016-05-29 04:03:54 -04:00
Johnny Robeson
c330f3abc3 replace deprecated assert_() with assertTrue() 2016-05-29 03:56:39 -04:00
Guilherme Danno
271f7c8d17 new template path functions: %first{} and %ifdef{} (#1951)
* New template functions: %first{} and %ifdef{}
* Add documentation
* Add to changelog
2016-04-23 13:59:25 -03:00
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Peter Kessen
92a9c6ff50 Removed unicode_literals from test_library 2016-02-28 13:04:47 +01:00
Jack Wilsdon
12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Adrian Sampson
d1adaa9cb7 Merge pull request #1749 from diego-plan9/humanlength
Format length as M:SS by default
2015-12-12 17:29:56 -08:00
Diego Moreda
3e2d2479b5 Fix test that depended on local time, 2 2015-12-09 16:42:47 +01:00
Diego Moreda
25cb556ea2 Fix test that depended on local time 2015-12-09 16:40:14 +01:00
Diego Moreda
2f2cdd24da Fix unused import leftover on test_library 2015-12-09 16:31:45 +01:00
Diego Moreda
0e64275993 Add tests for library-specific field types 2015-12-09 16:07:01 +01:00
Peter Kessen
ceafad2651 Fixed testcase TestLibrary.test_write_with_custom_path
on windows it is important to use syspath with functions
to modify path
2015-12-05 15:05:25 +01:00
Peter Kessen
c086a634b6 Fixed testcase TestLibrary.test_no_write_permission
on windows it is important to use syspath with functions
to modify path
2015-12-05 14:58:03 +01:00
Ben Ockmore
de17d000bd Rewrote path legalization code to be two module functions rather than class methods. Also made algorithm more predictable, and added an extra test. 2015-07-07 01:17:12 +01:00