Classify static and smart crates
This commit is contained in:
+32
-1
@@ -1,6 +1,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
from serato_doctor.health import analyze_health
|
||||
from serato_doctor.models.crate import Crate, CrateKind
|
||||
from serato_doctor.models.library import Library
|
||||
from serato_doctor.models.reference import TrackReference
|
||||
from serato_doctor.models.track import DiskTrack
|
||||
@@ -36,9 +37,10 @@ def test_health_report_exposes_each_metric():
|
||||
|
||||
assert report.score == 33.3
|
||||
assert report.score_basis == (
|
||||
"Resolved crate references / total crate references"
|
||||
"Resolved non-dynamic references / non-dynamic references scored"
|
||||
)
|
||||
assert report.total_references == 3
|
||||
assert report.scored_references == 3
|
||||
assert report.healthy_references == 1
|
||||
assert report.missing_references == 2
|
||||
assert report.unique_missing_filenames == 2
|
||||
@@ -54,3 +56,32 @@ def test_empty_library_has_no_health_score():
|
||||
|
||||
assert report.score is None
|
||||
assert report.total_references == 0
|
||||
assert report.scored_references == 0
|
||||
|
||||
|
||||
def test_smart_crate_references_are_reported_but_not_scored():
|
||||
static_reference = reference("Found.mp3")
|
||||
smart_reference = TrackReference(
|
||||
Path("Smartcrates/Dynamic.crate"),
|
||||
Path("/old/House/Dynamic.mp3"),
|
||||
"Dynamic.mp3",
|
||||
)
|
||||
crates = [
|
||||
Crate(Path("Subcrates/Static.crate"), (static_reference,), CrateKind.STATIC),
|
||||
Crate(
|
||||
Path("Smartcrates/Dynamic.crate"),
|
||||
(smart_reference,),
|
||||
CrateKind.SMART,
|
||||
),
|
||||
]
|
||||
library = Library.from_crates(crates, [track("Found.mp3")])
|
||||
|
||||
report = analyze_health(library)
|
||||
|
||||
assert report.score == 100.0
|
||||
assert report.total_references == 2
|
||||
assert report.scored_references == 1
|
||||
assert report.missing_references == 0
|
||||
assert report.static_crates == 1
|
||||
assert report.smart_crates == 1
|
||||
assert report.dynamic_references_excluded == 1
|
||||
|
||||
Reference in New Issue
Block a user