Commit graph

135 commits

Author SHA1 Message Date
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
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
f33d922898 Removed unicode_literals from test_query 2016-02-24 18:24:29 +01:00
Adrian Sampson
19a5d8c45f Add failing test for #1865 2016-02-04 11:35:23 -08:00
Adrian Sampson
25045245d6 Use two items when testing path queries 2016-02-04 11:29:11 -08:00
Jack Wilsdon
12cd5306b7 Update copyright dates to 2016 2015-12-30 15:42:06 +00:00
Peter Kessen
4937cc7e9e fixed format 2015-12-02 22:13:38 +01:00
Peter Kessen
de7d9d6b0d Tried to fix test on windows
test_slashed_query_matches_path (test.test_query.PathQueryTest)
2015-12-02 22:04:07 +01:00
Adrian Sampson
6cb8db3b2e Merge pull request #1728 from diego-plan9/notquery
Add boolean "not" query operator
2015-11-20 10:00:05 -08:00
Diego Moreda
51bf6a1c9f Add documentation for NotQuery, cleanup
* Add changelog and query.rst documentation entries for the usage of negated
queries.
* Cleanup NotQuery class as suggested during code review (PEP conforming
docstring, clarification on empty clause match behaviour).
2015-11-20 18:06:22 +01:00
Peter Kessen
3eb8008b11 added encoding as comment in files
added line like
# -*- coding: utf-8 -*-
to all files with correct license in header
2015-11-19 18:41:01 +01:00
Diego Moreda
40bfed756b Revise not query syntax, cleanup, modify docstring
* Revise the NotQuery syntax, replacing the '¬' character with '^'. Fix tests
to conform to this change, and cleanup the PARSE_QUERY_PART_REGEX.
* Modify parse_query_part() docstring to mention the negate parameter on the
returned tuple, and added an example.
2015-11-19 18:04:47 +01:00
Diego Moreda
e69b3b3c5d Fix NotQuery assertion by using sets, not lists
* Fix issue with an assertion that was order-sensitive and caused a problem on
some tox runs.
2015-11-18 17:40:47 +01:00
Diego Moreda
e457479558 Add NotQuery syntax tests
* Add tests to NotQueryTest for testing the results of using queries with
negation.
* Fix issue on test_dbcore due to the modifications on the tuple returned by
parse_query_part (the number of elements was changed from 3 to 4).
2015-11-18 17:27:22 +01:00
Diego Moreda
dd8b80e320 Make NotQuery subclass Query, update tests
* Modify NotQuery so it subclasses Query instead of MutableCollectionQuery.
* Update instances where NotQuery objects are created on tests and queryparse,
as NotQuery expects a single Query as a parameter to the constructor instead of
a list of Queries.
2015-11-18 14:54:20 +01:00
Diego Moreda
f2c8e9ff07 Add "not" query operator, initial draft
* Add support for user friendly "not" operator in queries without requiring to
use regular expressions, via adding NotQuery to beets.dbcore.query.
* Update the prefix list at library.parse_query_parts() and the query parsing
mechanisms in order to create a NotQuery when the prefix is found.
* Add two TestCases, NotQueryMatchTest as the negated version of MatchTest, and
the more generic NotQueryTest for testing the integration of the NotQuery with
the rest of the existing Query subclasses.
2015-11-16 21:36:42 +01:00