updating tests after adding new fixtures
This commit is contained in:
parent
d747d3d3a9
commit
e39b438a0a
@ -1,13 +1,13 @@
|
|||||||
\i test/fixtures/load_fixtures.sql
|
\i test/fixtures/load_fixtures.sql
|
||||||
SET client_min_messages TO WARNING;
|
SET client_min_messages TO WARNING;
|
||||||
\set ECHO all
|
\set ECHO none
|
||||||
obs_getdemographicsnapshot_test_no_returns
|
obs_getdemographicsnapshot_test_no_returns
|
||||||
t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_get_gini_index_at_test_point
|
obs_get_median_income_at_test_point
|
||||||
t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_get_gini_index_at_null_island
|
obs_get_median_income_at_null_island
|
||||||
t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getpoints_for_test_point
|
obs_getpoints_for_test_point
|
||||||
@ -28,41 +28,41 @@ t
|
|||||||
null_island_segmentation
|
null_island_segmentation
|
||||||
t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
getcategories_at_test_point_1|getcategories_at_test_point_2
|
getcategories_at_test_point_1
|
||||||
t|t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
getcategories_at_null_island
|
getcategories_at_null_island
|
||||||
t
|
t
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getmeasure
|
obs_getmeasure_total_pop_point
|
||||||
9516.27915900609
|
10923.093200390833950
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getmeasure
|
obs_getmeasure_total_pop_polygon
|
||||||
1655
|
12327.3133495107
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getmeasure
|
obs_getmeasure_total_male_point_denominator
|
||||||
0.64652567975830779836
|
0.62157894736842105263
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getmeasure
|
obs_getmeasure_total_male_poly_denominator
|
||||||
0.64652567975830815710
|
0.49026340444793965457
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getcategory
|
obs_getcategory_point
|
||||||
Wealthy, urban without Kids
|
Wealthy, urban without Kids
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getcategory
|
obs_getcategory_polygon
|
||||||
Low income, mix of minorities
|
Low income, mix of minorities
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getpopulation
|
obs_getpopulation
|
||||||
9516.27915900609
|
10923.093200390833950
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getpopulation
|
obs_getpopulation_polygon
|
||||||
1655
|
12327.3133495107
|
||||||
|
(1 row)
|
||||||
|
obs_getuscensusmeasure_point_male_pop
|
||||||
|
6789.5647735060920500
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getuscensusmeasure
|
obs_getuscensusmeasure
|
||||||
6152.51885204623
|
6043.63061042765
|
||||||
(1 row)
|
|
||||||
obs_getuscensusmeasure
|
|
||||||
1070
|
|
||||||
(1 row)
|
(1 row)
|
||||||
obs_getuscensuscategory
|
obs_getuscensuscategory
|
||||||
Wealthy, urban without Kids
|
Wealthy, urban without Kids
|
||||||
|
@ -46,9 +46,9 @@ WITH result as (
|
|||||||
SELECT
|
SELECT
|
||||||
(cdb_observatory._OBS_GetPoints(
|
(cdb_observatory._OBS_GetPoints(
|
||||||
cdb_observatory._TestPoint(),
|
cdb_observatory._TestPoint(),
|
||||||
'obs_1a098da56badf5f32e336002b0a81708c40d29cd'::text, -- see example in obs_geomtable
|
'obs_c6fb99c47d61289fbb8e561ff7773799d3fcc308'::text, -- block groups (see _obs_geomtable)
|
||||||
(Array['{"colname":"total_pop","tablename":"obs_1a098da56badf5f32e336002b0a81708c40d29cd","aggregate":"sum","name":"Total Population","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'::json])
|
(Array['{"colname":"total_pop","tablename":"obs_1a098da56badf5f32e336002b0a81708c40d29cd","aggregate":"sum","name":"Total Population","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'::json])
|
||||||
))[1]::text = '{"value":4809.07989821893,"name":"Total Population","tablename":"obs_1a098da56badf5f32e336002b0a81708c40d29cd","aggregate":"sum","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'
|
))[1]::text = '{"value":10923.093200390833950,"name":"Total Population","tablename":"obs_1a098da56badf5f32e336002b0a81708c40d29cd","aggregate":"sum","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'
|
||||||
as OBS_GetPoints_for_test_point;
|
as OBS_GetPoints_for_test_point;
|
||||||
-- what happens at null island
|
-- what happens at null island
|
||||||
|
|
||||||
@ -68,9 +68,9 @@ SELECT
|
|||||||
SELECT
|
SELECT
|
||||||
(cdb_observatory._OBS_GetPolygons(
|
(cdb_observatory._OBS_GetPolygons(
|
||||||
cdb_observatory._TestArea(),
|
cdb_observatory._TestArea(),
|
||||||
'obs_1a098da56badf5f32e336002b0a81708c40d29cd'::text, -- see example in obs_geomtable
|
'obs_c6fb99c47d61289fbb8e561ff7773799d3fcc308'::text, -- see example in obs_geomtable
|
||||||
Array['{"colname":"total_pop","tablename":"obs_1a098da56badf5f32e336002b0a81708c40d29cd","aggregate":"sum","name":"Total Population","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'::json]
|
Array['{"colname":"total_pop","tablename":"obs_1a098da56badf5f32e336002b0a81708c40d29cd","aggregate":"sum","name":"Total Population","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'::json]
|
||||||
))[1]::text = '{"value":1570.78845496678,"name":"Total Population","tablename":"obs_1a098da56badf5f32e336002b0a81708c40d29cd","aggregate":"sum","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'
|
))[1]::text = '{"value":12327.3133495107,"name":"Total Population","tablename":"obs_1a098da56badf5f32e336002b0a81708c40d29cd","aggregate":"sum","type":"Numeric","description":"The total number of all people living in a given geographic area. This is a very useful catch-all denominator when calculating rates."}'
|
||||||
as OBS_GetPolygons_for_test_point;
|
as OBS_GetPolygons_for_test_point;
|
||||||
|
|
||||||
-- see what happens around null island
|
-- see what happens around null island
|
||||||
@ -102,9 +102,7 @@ WITH result as (
|
|||||||
'us.census.tiger.census_tract'
|
'us.census.tiger.census_tract'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
select (expected)[1]::text = '{"category":"Wealthy, urban without Kids","name":"Spielman-Singleton Segments: 10 Clusters","tablename":"obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d","aggregate":null,"type":"Text","description":"Sociodemographic classes from Spielman and Singleton 2015, 10 clusters"}' as GetCategories_at_test_point_1,
|
select (expected)[1]::text = '{"category":"Wealthy, urban without Kids","name":"Spielman-Singleton Segments: 10 Clusters","tablename":"obs_65f29658e096ca1485bf683f65fdbc9f05ec3c5d","aggregate":null,"type":"Text","description":"Sociodemographic classes from Spielman and Singleton 2015, 10 clusters"}' as GetCategories_at_test_point_1
|
||||||
(expected)[2]::text = '{"category":"Wealthy, urban without Kids","name":"Spielman-Singleton Segments: 10 Clusters","tablename":"obs_11ee8b82c877c073438bc935a91d3dfccef875d1","aggregate":null,"type":"Text","description":"Sociodemographic classes from Spielman and Singleton 2015, 10 clusters"}' as GetCategories_at_test_point_2,
|
|
||||||
array_length(expected, 1)
|
|
||||||
from result;
|
from result;
|
||||||
|
|
||||||
WITH result as (
|
WITH result as (
|
||||||
@ -115,7 +113,7 @@ WITH result as (
|
|||||||
'us.census.tiger.census_tract'
|
'us.census.tiger.census_tract'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
select expected is null as GetCategories_at_null_island
|
select expected[0] is NULL as GetCategories_at_null_island
|
||||||
from result;
|
from result;
|
||||||
|
|
||||||
-- Point-based OBS_GetMeasure, default normalization (area)
|
-- Point-based OBS_GetMeasure, default normalization (area)
|
||||||
@ -123,32 +121,32 @@ SELECT * FROM
|
|||||||
cdb_observatory.OBS_GetMeasure(
|
cdb_observatory.OBS_GetMeasure(
|
||||||
cdb_observatory._TestPoint(),
|
cdb_observatory._TestPoint(),
|
||||||
'us.census.acs.B01001001'
|
'us.census.acs.B01001001'
|
||||||
);
|
) As t(OBS_GetMeasure_total_pop_point);
|
||||||
|
|
||||||
-- Poly-based OBS_GetMeasure, default normalization (none)
|
-- Poly-based OBS_GetMeasure, default normalization (none)
|
||||||
SELECT * FROM
|
SELECT * FROM
|
||||||
cdb_observatory.OBS_GetMeasure(
|
cdb_observatory.OBS_GetMeasure(
|
||||||
cdb_observatory._TestArea(),
|
cdb_observatory._TestArea(),
|
||||||
'us.census.acs.B01001001'
|
'us.census.acs.B01001001'
|
||||||
);
|
) As t(OBS_GetMeasure_total_pop_polygon);
|
||||||
|
|
||||||
-- Point-based OBS_GetMeasure with denominator normalization
|
-- Point-based OBS_GetMeasure with denominator normalization
|
||||||
SELECT cdb_observatory.OBS_GetMeasure(
|
SELECT cdb_observatory.OBS_GetMeasure(
|
||||||
cdb_observatory._TestPoint(),
|
cdb_observatory._TestPoint(),
|
||||||
'us.census.acs.B01001002', 'denominator');
|
'us.census.acs.B01001002', 'denominator') As OBS_GetMeasure_total_male_point_denominator;
|
||||||
|
|
||||||
-- Poly-based OBS_GetMeasure with denominator normalization
|
-- Poly-based OBS_GetMeasure with denominator normalization
|
||||||
SELECT cdb_observatory.OBS_GetMeasure(
|
SELECT cdb_observatory.OBS_GetMeasure(
|
||||||
cdb_observatory._TestArea(),
|
cdb_observatory._TestArea(),
|
||||||
'us.census.acs.B01001002', 'denominator');
|
'us.census.acs.B01001002', 'denominator') As OBS_GetMeasure_total_male_poly_denominator;
|
||||||
|
|
||||||
-- Point-based OBS_GetCategory
|
-- Point-based OBS_GetCategory
|
||||||
SELECT cdb_observatory.OBS_GetCategory(
|
SELECT cdb_observatory.OBS_GetCategory(
|
||||||
cdb_observatory._TestPoint(), 'us.census.spielman_singleton_segments.X10');
|
cdb_observatory._TestPoint(), 'us.census.spielman_singleton_segments.X10') As OBS_GetCategory_point;
|
||||||
|
|
||||||
-- Poly-based OBS_GetCategory
|
-- Poly-based OBS_GetCategory
|
||||||
SELECT cdb_observatory.OBS_GetCategory(
|
SELECT cdb_observatory.OBS_GetCategory(
|
||||||
cdb_observatory._TestArea(), 'us.census.spielman_singleton_segments.X10');
|
cdb_observatory._TestArea(), 'us.census.spielman_singleton_segments.X10') As obs_getcategory_polygon;
|
||||||
|
|
||||||
-- Point-based OBS_GetPopulation, default normalization (area)
|
-- Point-based OBS_GetPopulation, default normalization (area)
|
||||||
SELECT * FROM
|
SELECT * FROM
|
||||||
@ -160,11 +158,11 @@ SELECT * FROM
|
|||||||
SELECT * FROM
|
SELECT * FROM
|
||||||
cdb_observatory.OBS_GetPopulation(
|
cdb_observatory.OBS_GetPopulation(
|
||||||
cdb_observatory._TestArea()
|
cdb_observatory._TestArea()
|
||||||
);
|
) As obs_getpopulation_polygon;
|
||||||
|
|
||||||
-- Point-based OBS_GetUSCensusMeasure, default normalization (area)
|
-- Point-based OBS_GetUSCensusMeasure, default normalization (area)
|
||||||
SELECT cdb_observatory.obs_getuscensusmeasure(
|
SELECT cdb_observatory.obs_getuscensusmeasure(
|
||||||
cdb_observatory._testpoint(), 'male population');
|
cdb_observatory._testpoint(), 'male population') As obs_getuscensusmeasure_point_male_pop;
|
||||||
|
|
||||||
-- Poly-based OBS_GetUSCensusMeasure, default normalization (none)
|
-- Poly-based OBS_GetUSCensusMeasure, default normalization (none)
|
||||||
SELECT cdb_observatory.obs_getuscensusmeasure(
|
SELECT cdb_observatory.obs_getuscensusmeasure(
|
||||||
|
Loading…
Reference in New Issue
Block a user