Commit graph

89 commits

Author SHA1 Message Date
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
Ben Ockmore
d07c8fde69 Added loop to iterate over sanitize/truncate until stable. Enabled test_truncation_does_not_conflict_with_replacement test. Fixes #496. 2015-07-06 14:57:15 +01:00
Adrian Sampson
56ca69d63d Fix #1404 by only writing _media_fields
This just makes "date" and "original_date" into ordinary flexible fields,
which is probably the way it should be.
2015-04-16 19:55:48 -07:00
Bruno Cauet
58b39f1000 Merge branch 'master' into subcommand-auto-format-path 2015-03-05 17:53:31 +01:00
Bruno Cauet
f14f47f059 Renamed list_format_* into format_* 2015-03-04 16:51:28 +01:00
Adrian Sampson
e14f28fdda Merge pull request #1330 from brunal/path-query-case-sensitivity
Fix path query case sensitivity

Conflicts:
	docs/changelog.rst
2015-03-01 17:01:45 -08:00
Bruno Cauet
cb504ad163 library.parse_query_string: assert query is unicode 2015-03-01 15:01:27 +01:00
Bruno Cauet
952081e5ed Revert "InvalidQueryError: resist to any query"
This reverts commit 9e5e7a28e5.
2015-03-01 14:52:31 +01:00
Adrian Sampson
ccbe907971 Add (skipped) test for #496 2015-02-24 22:18:05 -08:00
Bruno Cauet
9e5e7a28e5 InvalidQueryError: resist to any query
Even though queries may not contain non-utf8 code points
InvalidQueryError ought to be prudent, for such an invalid query would
raise an InvalidQueryError which therefore has to be able to manipulate
the invalid query.
2015-02-18 19:31:07 +01:00
Bruno Cauet
489b6b2e7e Move many tests from test_library to test_util
Sice they only test functions from beets/util/__init__.py there's not
reason for them to reside in test/test_library.py.
2015-02-16 11:53:01 +01:00
Tom Jaspers
9cdd541943 Error handling for 'filesize' field
- Logs a warning and returns 0 if getsize fails
- Add tests for this

Fix #1326
2015-02-13 12:24:21 +01:00
Bruno Cauet
e1e46df1b3 Fix path truncation test: really use bytes
Test is to use bytes but because of __future__.unicode_literals it used
unicode.
2015-02-12 11:56:54 +01:00