Commit graph

74 commits

Author SHA1 Message Date
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
Bruno Cauet
7476d6be46 InvalidQuery*Error extend ParsingError
And InvalidQueryArgumentTypeError does not extend TypeError anymore.
2015-02-09 19:25:23 +01:00
Bruno Cauet
54887e7655 Widen usage of InvalidQueryError
Replace previous InvalidQueryError with InvalidQueryArgumentTypeError
which extends the former as TypeError. However they lack context: the
query that caused the error.

Raise an InvalidQueryError when a shell-like expression cannot be parsed
by shlex.

Improve #1290.
2015-02-09 15:28:06 +01:00
Thomas Scholtes
51ab099145 Extend item.write() to embed images without changing item
Fixes #1241 and geigerzaehler/beets-check#14

Before, `embed_item` would add the images to the item and then call
`item.write()` to write the item data, including the image, to the
file. This would trigger `item.store()` in the `after_write` hook of
the check plugin. This would in turn try to persist the temporary
`images` attribute of the item, resulting in an SQL error.
2015-02-01 15:35:24 +01:00
Bruno Cauet
dbef31776f Replace ur'' strings by r'' strings
Since we use unicode_literals they are equivalent, but ur'' strings are
a syntax error in python 3.0+
2015-01-27 09:02:44 +01:00
Adrian Sampson
b8dab9cf9f Merge pull request #1247 from brunal/future
Use all __future__ imports in beets core

Conflicts:
	beetsplug/web/__init__.py
	test/test_embedart.py
2015-01-26 17:02:07 -08:00
Bruno Cauet
060c275fd3 Merge branch 'master' into libmodels-formatting
Conflicts:
	beetsplug/embedart.py
2015-01-26 10:17:15 +01:00
Bruno Cauet
bd29ab21e1 Delete outdated disabled test in test_library.py
TemplateTest.album_fields_override_item_values() never ran because of
its name (missing 'test_' prefix). When run it now fails for it targets
outdated functionality.
2015-01-25 21:38:29 +01:00
Bruno Cauet
73d200184b Implement __format__ on Album and Item
Cut the need to format manually (and often incorrectly) when logging by
implementing the __format__ magic method (see PEP 3101) on LibModel
(the parent class of Album & Item).

Based on a discussion in PR #1262
2015-01-25 19:41:49 +01:00
Bruno Cauet
02d8e88ef1 Replace all mentions of 'str' with 'bytes' 2015-01-20 12:48:15 +01:00
Bruno Cauet
9c41c39913 Do __name__ comparison with bytes and not unicode 2015-01-20 12:03:57 +01:00
Bruno Cauet
2dab8e5fd6 Import unicode_literals in beets package 2015-01-19 21:41:33 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.

Goal is smoothing the transition to python 3.
2015-01-19 12:25:16 +01:00
Bruno Cauet
2902cda036 tests: use absolute imports everywhere 2015-01-19 12:25:15 +01:00
Frederik “Freso” S. Olesen
4b1f0cbf48 Happy 2015. ;)
See 7a410f636b

Command used:

    git grep -l 'Copyright 201'|xargs sed -i -E 's/Copyright 201./Copyright 2015/'`
2015-01-08 21:37:09 +01:00
Adrian Sampson
daeab3d3a9 Add (skipped) tests for #359 2014-11-22 21:48:06 -08:00