Skip to content

Commit 799e5c6

Browse files
tests: improve audio tests (#1294)
1 parent 4924320 commit 799e5c6

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

tests/test_audio.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99

1010

1111
def test_audio_Artist_attr(artist):
12+
artist_guids = [
13+
"mbid://069a1c1f-14eb-4d36-b0a0-77dffbd67713",
14+
"plex://artist/5d07bdaf403c64029060f8c4",
15+
]
1216
artist.reload()
1317
assert utils.is_datetime(artist.addedAt)
1418
assert artist.albumSort == -1
@@ -17,8 +21,8 @@ def test_audio_Artist_attr(artist):
1721
if artist.countries:
1822
assert "United States of America" in [i.tag for i in artist.countries]
1923
# assert "Electronic" in [i.tag for i in artist.genres]
20-
assert artist.guid == "plex://artist/5d07bdaf403c64029060f8c4"
21-
assert "mbid://069a1c1f-14eb-4d36-b0a0-77dffbd67713" in [i.id for i in artist.guids]
24+
assert artist.guid in artist_guids
25+
assert artist_guids[0] in [i.id for i in artist.guids]
2226
assert artist.index == 1
2327
assert utils.is_metadata(artist._initpath)
2428
assert utils.is_metadata(artist.key)

tests/test_library.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -785,15 +785,15 @@ def _test_library_search(library, obj): # noqa: C901
785785
fields = library.listFields(obj.type)
786786
for field in fields:
787787
fieldAttr = field.key.split(".")[-1]
788+
if fieldAttr in {"unmatched", "userRating"}:
789+
continue
788790
operators = library.listOperators(field.type)
789791
if field.type in {"tag", "string"}:
790792
operators += [andOp]
791793

792794
for operator in operators:
793795
if (
794-
fieldAttr == "unmatched" and operator.key == "!="
795-
or fieldAttr in {"audienceRating", "rating"} and operator.key in {"=", "!="}
796-
or fieldAttr == "userRating"
796+
fieldAttr in {"audienceRating", "rating"} and operator.key in {"=", "!="}
797797
):
798798
continue
799799

@@ -846,7 +846,7 @@ def _do_test_library_search(library, obj, field, operator, searchValue):
846846
if operator.key.startswith("!") or operator.key.startswith(">>") and (searchValue == 1 or searchValue == "1s"):
847847
assert obj not in results
848848
else:
849-
assert obj in results
849+
assert obj in results, f"Unable to search {obj.type} by {field.key} using {operator.key} and value {searchValue}."
850850

851851

852852
def test_library_common(movies):

0 commit comments

Comments
 (0)