Commit Graph

24 Commits

Author SHA1 Message Date
Šarūnas Nejus
856087258b dbcore: rename Database._fetch to Database.get_results
This removes ambiguity with Library._fetch
2026-07-16 13:11:16 +01:00
Šarūnas Nejus
3f277ad5a0 typing: feed PathLike as database path 2026-07-16 13:11:16 +01:00
TowyTowy
4a1e9164a1 Fix uncaught KeyError on date queries containing a stray pipe
The relative-date regex used character classes [+|-] and [y|m|w|d],
which mistakenly treat | as a literal member rather than alternation.
As a result a value like added:2000|2001 (as a user might type expecting
| to mean "or") captured | as the relative-date unit and crashed with
an uncaught KeyError in Period.parse instead of raising the documented
InvalidQueryArgumentValueError.

Remove the stray | from both character classes so malformed date strings
fall through to the normal invalid-date error path.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-15 21:55:46 +02:00
Šarūnas Nejus
1266256f5e typing: fix beets.dbcore.types 2026-07-15 20:23:55 +01:00
Valentyn Kit
eb7c832fc9 Make InQuery hashable when its pattern is a list
InQuery inherited FieldQuery.__hash__, which hashes the pattern directly.
A list pattern raises `unhashable type: 'list'`, which broke the
smartplaylist `splupdate` command whenever a `playlist:` query was configured.
2026-07-15 08:02:01 +01:00
TowyTowy
2293d2f60a Fix crash when sorting by a nullable field missing on some items
Sorting by a field whose declared type is nullable (its null value is
`None`, e.g. `NullInteger`/`NullFloat`) raised `TypeError: '<' not
supported between instances of ...` when the field was present on some
objects but missing on others, because `FieldSort.sort` compared `None`
against real values.

Group missing values together in the sort key so they are never compared
against present ones: they are ordered first when sorting ascending and
last when descending, matching SQLite's default ordering of NULLs used by
the fast `FixedFieldSort` path.

Fixes #3461.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-13 13:36:23 +01:00
Šarūnas Nejus
230bf19c7f Remove redundant test logic exposed by full coverage
- Removing the coverage omit configuration exposed unused branches, helpers, and
  fixtures across the test suite.
- Delete that redundant logic and simplify affected tests while preserving their
  behavior.
2026-07-07 15:57:35 +01:00
Šarūnas Nejus
79c7d69311 Remove wrongly added copyright markers 2026-07-07 15:57:35 +01:00
Šarūnas Nejus
7cf8896597 Make the global config fixture function-scoped 2026-07-03 21:21:19 +01:00
Šarūnas Nejus
900543baca Move test modules under folders that they belong to 2026-06-30 21:48:40 +01:00
Sebastian Mohr
54a2bd20e1 Removed This file is part of beets... headers. 2026-06-29 11:20:15 +02:00
Šarūnas Nejus
de5c690181 Use class-scoped config across the test module 2026-06-24 17:01:19 +01:00
Šarūnas Nejus
af1e6ceb4d Remove duplicate branches 2026-06-24 17:01:19 +01:00
Šarūnas Nejus
31f7cd4360 Tighten config sort tests
- Combine default and override sort assertions for items and albums.
- Use the config fixture and exact ordered results to avoid global config state.
2026-06-24 17:01:19 +01:00
Šarūnas Nejus
616b1b2b0b Refactor TestNonExistingField
- Consolidate duplicate sort test coverage with parametrized cases.
- Keep missing-field and mixed-presence behavior covered while reducing repeated
  assertions.
2026-06-24 17:01:19 +01:00
Šarūnas Nejus
85e4c607d2 Simplify TestCaseSensitivity 2026-06-24 17:01:19 +01:00
Šarūnas Nejus
fb812daebe Simplify paths 2026-06-24 17:01:19 +01:00
Šarūnas Nejus
eb07fa3a40 Consolidate sort query tests
- Replace duplicate direct MultipleSort checks with parametrized query-string
  cases covering single-field, multi-field, fixed, flex, and computed sort
  behavior.
- Reduce test repetition while keeping the same sort behavior coverage.
2026-06-24 17:01:19 +01:00
Šarūnas Nejus
349b082232 Parametrize descending sort coverage 2026-06-24 17:01:19 +01:00
Šarūnas Nejus
2d98777205 Parametrize ascending sort coverage
- Consolidate duplicate ascending sort tests across item and album fixed and
  flexible fields.
2026-06-24 17:01:19 +01:00
Šarūnas Nejus
da1969125b Only set required fields 2026-06-24 17:01:19 +01:00
Šarūnas Nejus
100a645ffa Use pytest 2026-06-24 17:01:19 +01:00
Šarūnas Nejus
0cd20798aa sort: Update dotted sort references 2026-05-17 07:39:13 +01:00
Šarūnas Nejus
2db5383850 Move test_sort.py under test/dbcore 2026-05-17 07:39:13 +01:00