Commit graph

137 commits

Author SHA1 Message Date
Šarūnas Nejus
6a7832f207
Adjust tests to work in Windows 2025-05-04 12:23:26 +01:00
Šarūnas Nejus
5826d6b59b
Remove handling of mbcs encoding
This has been phased out in Python 3.6.

https://peps.python.org/pep-0529/
2025-05-04 12:23:26 +01:00
Šarūnas Nejus
4fcb148d60
Add test for legalization logic 2025-05-04 12:23:26 +01:00
Šarūnas Nejus
d3186859ac
Remove unused platform parameter in item.destination 2025-05-04 12:23:25 +01:00
Šarūnas Nejus
06dd2738bb
Remove never used replacements paramater from item.destination 2025-05-04 12:23:25 +01:00
Šarūnas Nejus
52951bf719
Fix legalize_path types
Background
  The `_legalize_stage` function was causing issues with Mypy due to
  inconsistent type usage between the `path` and `extension` parameters.
  This inconsistency stemmed from the `fragment` parameter influencing the
  types of these variables.

Key issues
  1. `path` was defined as `str`, while `extension` was `bytes`.
  2. Depending on `fragment`, `extension` could be either `str` or `bytes`.
  3. `path` was sometimes converted to `bytes` within `_legalize_stage`.

Item.destination` method
  - The `fragment` parameter determined the output format:
    - `False`: Returned absolute path as bytes (default)
    - `True`: Returned path relative to library directory as str

Thus
  - Rename `fragment` parameter to `relative_to_libdir` for clarity
  - Ensure `Item.destination` returns `bytes` in all cases
  - Code expecting strings now converts the output to `str`
  - Use only `str` type in `_legalize_stage` and `_legalize_path`
    functions
  - These functions are no longer dependent on `relative_to_libdir`
2025-05-04 12:23:22 +01:00
Šarūnas Nejus
41907a96a6
Remove _common.album and use Album instead 2024-10-16 12:37:22 +01:00
Andrew Rogl
04ee04150a
Reworked #4709 after latest release (#5447)
Fixes #4709 SQL use of Double Quoted Strings.
2024-09-30 10:28:15 +01:00
Tânio Scherer
0b067e9f5b Create a new template function: capitalize
Update documentation

Update changelog
2024-09-05 23:00:50 -03:00
Šarūnas Nejus
46bdb84b46
Replace assertGreater and assertGreaterEqual 2024-08-12 08:43:43 +01:00
Šarūnas Nejus
6a3380bcb5
Replace assertLess and assertLessEqual 2024-08-12 08:43:43 +01:00
Šarūnas Nejus
eda0ef11d6
Replace assertIsInstance 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
f9359df0d1
Replace assertNotEqual 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
847e3858a6
Replace assertRaises 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
9a05d27acf
Replace assertEqual 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
6631b6aef6
Replace assertNotIn 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
11e948121c
Replace assertIn 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
2616bcc950
Replace assertIsNotNone 2024-08-12 08:43:41 +01:00
Šarūnas Nejus
5d4911e905
Replace assertIsNone 2024-08-12 08:43:41 +01:00
Šarūnas Nejus
0ecc345143
Replace assertTrue 2024-08-05 17:11:16 +01:00
Šarūnas Nejus
fcff5d72af
Remove def suite TestLoader definitions 2024-07-28 18:58:51 +01:00
Šarūnas Nejus
7d7f16395c
Remove redundant library setUp instructions 2024-07-28 18:58:34 +01:00
Šarūnas Nejus
2d5fd907c3
Remove redundant setup_beets and teardown_beets instructions 2024-07-28 18:58:34 +01:00
Šarūnas Nejus
b64eaeda0a
Rename LibTestCase to ItemInDBTestCase 2024-07-28 18:58:34 +01:00
Šarūnas Nejus
6c1e26acc9
Replace unittest.TestCase, TestHelper by BeetsTestCase 2024-07-28 18:58:34 +01:00
Šarūnas Nejus
3e278159ed
Dedupe TestHelper and _common.TestCase setup 2024-07-28 18:58:33 +01:00
freddiewanah
e0de6e1b89 refactor the test methods to avoid suboptimal asserts. 2024-04-08 21:39:25 +08:00
Lars Kruse
508d28f66b tests: move reusable test-related modules into the beets package
External Python packages interfacing beets may want to use an in-memory
beets library instance for testing beets-related code.
The `TestHelper` class is very helpful for this purpose.
Previously `TestHelper` was located in the `test/` directory.
Now it is part of `beets` itself (`beets.test.helper.TestHelper`) and
can be easily imported.
2024-01-15 19:40:57 +01:00
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
J0J0 Todos
94d00418b4 Fix test_albuminfo_change_artist_does_not_change_items
by adding (inherit=True) to fit with the new behaviour of the store() method
and add a second test that checks the opposite.
2023-08-23 06:34:16 +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
Katelyn Dickey
f0359007a5
Code style fixes 2023-01-31 11:26:22 -05:00
Katelyn Dickey
2c43adf463
Fix album store method to cascade flex field deletions to items 2023-01-31 01:31:53 -05:00
Adrian Sampson
5ae1e0f3c8
Adapt tests to latest Unidecode version
Unidecode 1.3.5 (a yanked PyPI version) changed the behavior of
Unidecode for some specific characters:

> Remove trailing space in replacements for vulgar fractions.

As luck would have it, our tests used the 1/2 character specifically to
test the behavior when these characters decoded to contain slashes. We
now pin a sufficiently recent version of Unidecode and adapt the tests
to match the new behavior.
2022-10-01 10:33:26 -07:00
Jaime Marquínez Ferrándiz
8d957f35f9 Add path template "sunique" to disambiguate between singleton tracks 2022-08-12 14:19:52 +02:00
Kirill A. Korinsky
c459ff26fb
Prevent fails of tests when path contains dots
Unit test may fails when path to temprorary library contains `.`; to
garantue that bug wasn't here, it forces to use one more `.` inside path.

Fixes: https://github.com/beetbox/beets/issues/4151
2021-11-19 16:54:28 +01:00
Julien Cassette
b67c25a55d Use slow queries for flexible attributes in aunique (fix #2678, close #3553) 2021-11-11 19:32:55 +01:00
Christopher Larson
86465e6437 Allow custom replacements in Item.destination
This allows for the use of differing replacements for destinations other than
the library, which is useful for beets-alternatives in the case where
filesystem requirements differ between the two paths.

Signed-off-by: Christopher Larson <kergoth@gmail.com>
2021-10-27 12:30:16 -07: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
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
Carl Suster
546bf3af7e mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
Guilherme Danno
fa1037ee28
Enhance %title (#3059)
Use string.capwords in %title to lower char after apostrophe
2018-11-29 11:30:48 -02:00
Jack Wilsdon
5ad16983d4
Fix miscellaneous typos 2018-10-09 01:11:06 +01:00
Adrian Sampson
9577a511cb Update tests for new Unidecode behavior: fix #2799
The library has started putting spaces around the expanded versions of
vulgar fraction characters.
2018-01-30 20:50:43 -05:00
diomekes
04f7915d41 change no-bracket argument from white space to empty 2017-01-20 22:47:47 -05:00
diomekes
eaa2161a90 fix empty disambig string test 2017-01-20 19:40:09 -05:00
diomekes
d10df34c65 add test for aunique without brackets 2017-01-20 09:06:38 -05:00
diomekes
3a967df396 simplify check for empty disam_val, update changelog and docs, add change bracket test 2017-01-19 20:41:44 -05:00