Thomas Scholtes
a92493cf12
Test queries on boolean fields
2014-09-15 00:48:18 +02:00
Thomas Scholtes
e5da5757c0
Preserve state in query tests
2014-09-15 00:36:24 +02:00
Thomas Scholtes
b86669fe05
Add integer query tests
2014-09-14 16:11:13 +02:00
Adrian Sampson
70b5a44ef4
Move query parsing to new dbcore.queryparse
...
Fix #649 .
2014-05-24 17:07:18 -07:00
Thomas Scholtes
f6f974ec87
Remove ITEM_* constants
...
We might consider renaming `Item._fields` to `Item.fields` since other parts of
beets use it as a replacement for `ITEM_KEYS`.
See also #650 .
2014-04-10 17:11:21 +02:00
Adrian Sampson
c196f20dfc
fix numeric queries over empty string ( fix #547 )
2014-02-17 22:51:53 -05:00
Adrian Sampson
83f981762c
fix #508 : crash when parsing empty query part
...
This is a regression created by my endeavor to have parse_query_part never
return None. Now the regular expression should really always match.
2014-01-26 10:51:58 -08:00
Adrian Sampson
74d0dc8352
further paramaterize parse_query_part
2014-01-21 19:09:34 -08:00
Adrian Sampson
4026c4b707
add query field to types
...
This is starting to get at the heart of the matter: now each type gets to
declare which Query subclass it wants to use, starting with NumericQuery.
2014-01-20 17:47:02 -08:00
Adrian Sampson
9ee4adc5e1
move remaining generic Query types to dbcore.query
...
NumericQuery is still broken. This, of course, is the whole reason for the
change.
2014-01-20 16:40:50 -08:00
Adrian Sampson
98bfbad089
test_query: use base test classes
2013-09-23 15:09:39 -07:00
Adrian Sampson
5007d1571f
merge disk and memory query tests
2013-09-23 15:05:47 -07:00
Adrian Sampson
4d0db3fcb4
tests: obviate on-disk test library
2013-09-23 10:57:17 -07:00
Adrian Sampson
bbac4ba109
numeric query tests
2013-09-16 17:19:40 -07:00
Adrian Sampson
c7fe017752
remove Library.{move,store} methods
...
These methods are now provided by LibModel, which makes dealing with items and
albums symmetric.
2013-08-21 15:34:45 -07:00
Adrian Sampson
0176b9742f
tests: unknown fields silently match nothing
...
Previously, an unknown field would be ignored. Now, they're treated as
flexattrs that just haven't been set yet (and thus always hold None).
2013-08-21 09:46:30 -07:00
Adrian Sampson
9e61e49457
fix NumericQuery constructor
2013-08-21 09:42:16 -07:00
Adrian Sampson
ec10f8c223
remove count() calls
...
I removed this method in an earlier commit.
2013-08-20 14:28:28 -07:00
Adrian Sampson
c1b66105dd
fix regex (and other) queries in path field
2013-08-04 13:12:25 -07:00
Adrian Sampson
8781433f59
add tests for matching floating-point ranges
2013-05-09 15:49:38 -07:00
Adrian Sampson
ea0928c845
generalize YearQuery to NumericQuery
2013-05-09 15:47:25 -07:00
Michael Schuerig
c102b3be90
Add error message and test for invalid years.
2013-04-25 00:45:05 +02:00
Michael Schuerig
fe41bba380
Add a query class for years with support for ranges.
2013-04-25 00:36:21 +02:00
Adrian Sampson
fe8092139b
fix construction of conditional path queries
...
I broke this in the last flurry of refactors but, as is usually the case, I
have no idea why it ever worked before.
2013-03-14 11:05:35 -07:00
Adrian Sampson
f005ec2de0
refactor: everything is like a plugin query ( #214 )
...
The initial idea for this refactor was motivated by the need to make
PluginQuery.match() have the same method signature as the match() methods on
other queries. That is, it needed to take an *item*, not the pattern and
value. (The pattern is supplied when the query is constructed.) So it made
sense to move the value-to-pattern code to a class method.
But then I realized that all the other FieldQuery subclasses needed to do
essentially the same thing. So I eliminated PluginQuery altogether and
refactored FieldQuery to subsume its functionality. I then changed all the
other FieldQuery subclasses to conform to the same pattern.
This has the side effect of allowing different kinds of queries (even
non-field queries) down the road.
2013-03-13 22:57:20 -07:00
Philippe Mongeau
685972bbc5
update query tests
...
fix escape colons in the query term
2013-03-10 20:26:45 -04:00
Adrian Sampson
7a410f636b
happy new year ✨
...
For future reference, this command did the trick:
ack -l 'Copyright 201' | xargs perl -pi -E 's/Copyright 201./Copyright 2013/'
2013-01-11 10:43:41 -08:00
Adrian Sampson
7158c01ff8
clean up outdated FIXMEs
2012-10-27 18:47:04 -07:00
Adrian Sampson
dc054907d5
fix non-string value matching in SubstringQuery
2012-09-09 12:17:13 -07:00
Adrian Sampson
90b3dba085
fix match() on RegexpQuery for non-string values
2012-09-08 16:24:39 -07:00
Adrian Sampson
073ee14e56
fix broken matching of path format queries ( #405 )
...
A bug in the shlex module with Unicode strings made these queries unparseable
and thus match every track.
2012-06-23 17:18:28 -07:00
Adrian Sampson
b68e87b92c
The Great Trailing Whitespace Purge of 2012
...
What can I say? I used to use TextMate!
2012-05-13 20:22:17 -07:00
Adrian Sampson
a28f930c52
transaction objects to control DB access
...
In an attempt to finally address the longstanding SQLite locking issues, I'm
introducing a way to explicitly, lexically scope transactions. The Transaction
class is a context manager that always fully fetches after SELECTs and
automatically commits on exit. No direct access to the library is allowed, so
all changes will eventually be committed and all queries will be completed. This
will also provide a debugging mechanism to show where concurrent transactions
are beginning and ending.
To support composition (transaction reentrancy), an internal, per-Library stack
of transactions is maintained. Commits only happen when the outermost
transaction exits. This means that, while it's possible to introduce atomicity
bugs by invoking Library methods outside of a transaction, you can conveniently
call them *without* a currently-active transaction to get a single atomic
action.
Note that this "transaction stack" concepts assumes a single Library object per
thread. Because we need to duplicate Library objects for concurrent access due
to sqlite3 limitation already, this is fine for now. Later, the interface should
provide one transaction stack per thread for shared Library objects.
2012-05-06 23:24:05 -07:00
Adrian Sampson
104aec3c2f
cleanup and docs for regular expression queries
2012-05-01 20:03:01 -07:00
Matteo Mecucci
46ec5db3fe
Added unit tests for regexps in query expressions.
2012-04-28 15:24:42 +02:00
Adrian Sampson
5a0105b12c
fall back to unittest2 ( #275 )
2012-01-31 15:25:09 -08:00
Adrian Sampson
fed8782ca1
fix Unicode queries from CLI arguments
2011-07-01 15:43:06 -07:00
Adrian Sampson
7f206baae5
automatically detect path queries containing / (finishes #146 )
2011-06-26 00:25:39 -07:00
Adrian Sampson
fcc2744ac5
use separate shell arguments for queries to preserve whitespace
2011-06-26 00:12:45 -07:00
Adrian Sampson
f3ac19622a
a couple of fixes for path queries
2011-06-25 14:23:32 -07:00
Adrian Sampson
6ca995f4e7
new path queries only match prefixes
2011-06-14 23:19:18 -07:00
Adrian Sampson
efa704f61e
fix crash when using an item-only field in an album query
2011-06-13 21:27:13 -07:00
Adrian Sampson
8341dee3ab
reorder items() and albums() parameters to reflect common use
2011-05-05 17:20:24 -07:00
Adrian Sampson
151df84150
remove unused artists() and get() methods on library
2011-05-05 17:11:54 -07:00
Adrian Sampson
85ddfa4381
relocatable test rsrc directory
2011-04-12 14:26:48 -07:00
Adrian Sampson
7503c1174a
more natural-looking queries for comp field
...
You can now use "comp:true" or "comp:yes" as well as "comp:1".
2011-04-10 22:55:25 -07:00
Adrian Sampson
d63a9fd188
singleton: queries
2011-04-09 16:13:12 -07:00
Adrian Sampson
43a5e913a7
move some reused testing stuff to _common module
2011-03-23 16:15:18 -07:00
Adrian Sampson
b5c38970cc
add test for wlof's albumartist searching fix
2011-03-23 16:01:35 -07:00
wlof
7be77a99d9
.. is now inserted at the beginning of sys.path so that local beets
...
files are used instead of installed ones
2011-03-19 01:45:35 +01:00