fmt
This commit is contained in:
parent
30d36a33d5
commit
7bc591be2b
10 changed files with 64 additions and 51 deletions
|
|
@ -11,8 +11,8 @@ use crate::data::{FeatureStats, PostcodePoiMetrics, PropertyData};
|
|||
use crate::utils::{postcode_outcode, postcode_sector};
|
||||
|
||||
use super::hexagon_stats::{
|
||||
CrimeAreaAverage, CrimeYearPoint, CrimeYearStats, EnumFeatureStats,
|
||||
HistogramStats, NumericFeatureStats, PricePoint,
|
||||
CrimeAreaAverage, CrimeYearPoint, CrimeYearStats, EnumFeatureStats, HistogramStats,
|
||||
NumericFeatureStats, PricePoint,
|
||||
};
|
||||
|
||||
/// Extract price history (year, price) pairs from matching rows, downsampled if needed.
|
||||
|
|
@ -398,7 +398,6 @@ pub fn compute_crime_by_year(
|
|||
out
|
||||
}
|
||||
|
||||
|
||||
/// Latest year present anywhere in the by-year crime dataset. The client
|
||||
/// compares each selection's last charted year against this to caption
|
||||
/// force-level publication gaps (e.g. Greater Manchester ends mid-2019) as
|
||||
|
|
@ -615,18 +614,12 @@ mod tests {
|
|||
assert_eq!(sector.as_deref(), Some("E14 2"));
|
||||
assert_eq!(out.len(), 2);
|
||||
|
||||
let burglary = out
|
||||
.iter()
|
||||
.find(|c| c.name == "Burglary (/yr, 7y)")
|
||||
.unwrap();
|
||||
let burglary = out.iter().find(|c| c.name == "Burglary (/yr, 7y)").unwrap();
|
||||
assert_eq!(burglary.national, Some(8.0));
|
||||
assert_eq!(burglary.outcode, Some(10.0));
|
||||
assert_eq!(burglary.sector, Some(5.0));
|
||||
|
||||
let robbery = out
|
||||
.iter()
|
||||
.find(|c| c.name == "Robbery (/yr, 7y)")
|
||||
.unwrap();
|
||||
let robbery = out.iter().find(|c| c.name == "Robbery (/yr, 7y)").unwrap();
|
||||
assert_eq!(robbery.national, Some(6.0));
|
||||
// The outcode value was NaN — dropped to None; the sector value is finite.
|
||||
assert_eq!(robbery.outcode, None);
|
||||
|
|
@ -637,9 +630,7 @@ mod tests {
|
|||
fn area_crime_averages_respect_fields_filter() {
|
||||
let avgs = sample_averages();
|
||||
// Area averages are keyed by the full crime-feature name.
|
||||
let fields: HashSet<String> = ["Burglary (/yr, 7y)".to_string()]
|
||||
.into_iter()
|
||||
.collect();
|
||||
let fields: HashSet<String> = ["Burglary (/yr, 7y)".to_string()].into_iter().collect();
|
||||
let (_, _, out) = area_crime_averages_for(Some("E14 2DG"), &avgs, true, &fields);
|
||||
assert_eq!(out.len(), 1);
|
||||
assert_eq!(out[0].name, "Burglary (/yr, 7y)");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue