Commit graph

150 commits

Author SHA1 Message Date
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
Jesse Bannon
f72261e44f
Add support for artists and albumartists multi-valued tags (#4743)
Adds the following fields with id3v2.4 multi-valued tag support to autotag:
    - artists, artists_sort, artists_credit
    - albumartists, albumartists_sort, albumartists_credit
    - mb_artistids, mb_albumartistids

MusicBrainz support to populate + write the above multi-valued tags by default. Can be toggled to use id3v2.3 or id3v2.4 tags via the existing beets configuration option `id3v23`.

Big thanks to @JOJ0, @OxygenCobalt, @arsaboo for testing + @sampsyo for the initial code review .
2023-09-09 09:46:26 +02:00
wisp3rwind
1ef6b90786 add missing syspath conversions (1/3, tests)
these are mostly in the tests, which didn't cause issues since the
affected directories usually have nice ASCII paths. For consistency, it
is nicer to always invoke syspath. That also avoids deprecation warnings
for the bytestring interfaces on Python <= 3.5. The bytestring
interfaces were undeprecated with PEP 529 in Python 3.6, such that we
didn't observe any actual failures.
2023-06-24 14:52:46 +02:00
Šarūnas Nejus
724b06a77d
Define SingletonQuery to perform filtering through SQL
This slightly speeds up the queries and there's a nice side-effect where
`singleton:1` and `singleton:0` now work fine!

This is ultimately building towards replacing as many python-only
queries with SQL equivalents.
2023-04-08 06:15:04 +01:00
wisp3rwind
e6fd038b0e tests: robustify path query / case_sensitive tests
- samefile exists on all platforms for recent python
- don't rely on monkey-patching os/os.path and on specifics on the
  implementation: as a result of doing so, the tests start failing in
  obscure ways as soon as the implementation (and its usage of
  os.path.exists and os.path.samefile) is changed
2023-02-12 16:16:43 +01:00
wisp3rwind
a6d74686d8 test: separate case_sensitive unit tests from PathQueryTest
- move tests for case_sensitive to test_util.py, since this is not
  really the concern of PathQueryTest
- removes part of the tests, since the tests that patch os.path.samefile
  and os.path.exists are super brittle since they test the
  implementation rather than the functionality of case_sensitive().
  This is a prepartory step for actually changing the implementation,
  which would otherwise break the tests in a confusing way...
2022-12-24 13:36:53 +01:00
Adrian Sampson
32ce44f589
One more test fix 2022-08-17 16:25:17 -07:00
Adrian Sampson
495c8accc0
Update exact query prefix tests 2022-08-17 16:11:16 -07:00
Šarūnas Nejus
72c5302004
Fix lints 2022-05-31 22:45:05 +01:00
Šarūnas Nejus
ba777dda50
Skip implicit paths tests for win32 2022-05-31 22:34:40 +01:00
Šarūnas Nejus
d68ed1adca
Make implicit path queries explicit and simplify their handling 2022-05-31 21:51:47 +01:00
Rob Crowell
2cab2d670a Fix bug in StringQuery.string_match 2022-01-25 16:24:04 -08:00
Rob Crowell
6457532274 Add query prefixes :~ and := 2022-01-24 19:19:48 -08:00
mousecloak
0132067a29
Fix @unittest.skipIf annotations to ignore only win32 2022-01-07 21:29:44 -08:00
Andrew Rogl
9106b41a50 Remove as many as possible sys.version tests 2021-08-27 10:24:27 +10: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
Adrian Sampson
ea3a6e5fd7
Skip some more tests on Windows
We should actually fix these, I suppose!
2021-08-21 13:35:28 -04:00
FichteFoll
eda9930c59
Merge remote-tracking branch 'upstream/master' into pr/item-album-fallback 2020-07-27 19:32:44 +02:00
Adam Jakab
611659d03c removed value_match and repr tests 2020-03-16 10:16:29 +01:00
Adam Jakab
ac1a3851fa typo fix 2020-03-15 19:36:38 +01:00
Adam Jakab
ceb901fcca struggling with old python 2020-03-15 19:30:24 +01:00
Adam Jakab
935768d983 fixing repr tests 2020-03-15 19:19:09 +01:00
Adam Jakab
8e68b5ff2e cleaning up 2020-03-15 15:54:01 +01:00
Adam Jakab
532c6d7c82 better repr testing #2 2020-03-15 15:41:32 +01:00
Adam Jakab
3f2f125b09 better repr testing 2020-03-15 15:24:17 +01:00
Adam Jakab
d6538e5f0c removed value_match method - not reachable? 2020-03-15 14:57:02 +01: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
Adrian Sampson
2a9be17cf6 Fix some brittle query tests
These were written to incidentally depend on Nones; the behavior they're
actually testing doesn't really have anything to say about None-ness.
2017-06-20 15:56:33 -04:00
discopatrick
58417526cb Rename InvalidQueryArgumentTypeError to InvalidQueryArgumentValueError
The way we use `InvalidQueryArgumentTypeError` is more akin to a `ValueError` than a `TypeError`. For example, we try to parse a string as an int, float, or date, but the parsing fails - there was nothing wrong with the type of the variable (string), but its contents were not parseable into the type we wanted - there was a problem with the value of the string.
2017-04-22 18:07:30 +01:00
discopatrick
d466f8802c passes flake8 2017-04-14 14:45:51 +01:00
discopatrick
ff4c0abcf1 tests ‘added’ instead of ‘mtime’ , and uses a correct date format 2017-04-14 13:05:13 +01:00
discopatrick
a3251ef7c6 skips tests for now 2017-04-14 01:13:02 +01: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
Johnny Robeson
24ae4bb056 encode path as utf-8 for is_path_query tests
is_path_query is not supposed to accept bytestrings
2016-07-02 01:24:25 -04:00
Adrian Sampson
736ad66518 Merge pull request #2066 from beetbox/use-six
Use the six package to handle py2/p3 compatibility
2016-06-25 18:09:56 -07:00
Johnny Robeson
34074b530b check changed text on py >3.5 in RegexpQuery test
See https://bugs.python.org/issue22364 for details
2016-06-24 19:09:29 -04:00
Johnny Robeson
e8afcbe7ec replace unicode with six.text_type 2016-06-24 05:53:49 -04:00
Johnny Robeson
fda3911323 bytestringify touch call in PathQueryTest 2016-06-17 02:00:20 -04:00
Johnny Robeson
4bbfe85c66 is_path_query takes unicode, so do that test_query
This fixes all but one instance that I'm not yet sure how to fix
2016-06-17 01:48:47 -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
Adrian Sampson
847c3bbfef Don't test absolute paths as queries on Windows 2016-06-08 10:41:32 -07:00
Adrian Sampson
bea77370c4 Simpler absolute path detection test 2016-06-08 10:34:21 -07:00
Adrian Sampson
416593fbf8 Split path detection tests 2016-06-08 10:31:05 -07:00
Johnny Robeson
790b1b5153 replace some filter/map calls with list comps
These are places where the surrounding/calling code needs a list, not an iter.
2016-06-08 00:17:18 -04:00
Adrian Sampson
5b2fb8dcdc Queries with \ are path queries on Windows 2016-05-31 13:29:00 -07:00
Adrian Sampson
1eb03a0de5 Query tests: use normalized paths
Match ordinary beets behavior by storing normalized paths in the
database. This matters on Windows, where normalization adds backslashes
and drive letters.
2016-05-31 13:12:32 -07: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
Jack Wilsdon
b1c58e99ec Update code to match pep8 naming standards 2016-04-27 20:15:10 +01:00
Adrian Sampson
eac7d64545 Merge branch 'master' into no_unicode_literals 2016-02-28 15:21:43 -08:00