aboutsummaryrefslogtreecommitdiff
path: root/tests/managers/thl/test_profiling/test_schema.py
diff options
context:
space:
mode:
authorMax Nanis2026-03-06 16:49:46 -0500
committerMax Nanis2026-03-06 16:49:46 -0500
commit91d040211a4ed6e4157896256a762d3854777b5e (patch)
treecd95922ea4257dc8d3f4e4cbe8534474709a20dc /tests/managers/thl/test_profiling/test_schema.py
downloadgeneralresearch-91d040211a4ed6e4157896256a762d3854777b5e.tar.gz
generalresearch-91d040211a4ed6e4157896256a762d3854777b5e.zip
Initial commitv3.3.4
Diffstat (limited to 'tests/managers/thl/test_profiling/test_schema.py')
-rw-r--r--tests/managers/thl/test_profiling/test_schema.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/managers/thl/test_profiling/test_schema.py b/tests/managers/thl/test_profiling/test_schema.py
new file mode 100644
index 0000000..ae61527
--- /dev/null
+++ b/tests/managers/thl/test_profiling/test_schema.py
@@ -0,0 +1,44 @@
+from generalresearch.models.thl.profiling.upk_property import PropertyType
+
+
+class TestUpkSchemaManager:
+
+ def test_get_props_info(self, upk_schema_manager, upk_data):
+ props = upk_schema_manager.get_props_info()
+ assert (
+ len(props) == 16955
+ ) # ~ 70 properties x each country they are available in
+
+ gender = [
+ x
+ for x in props
+ if x.country_iso == "us"
+ and x.property_id == "73175402104741549f21de2071556cd7"
+ ]
+ assert len(gender) == 1
+ gender = gender[0]
+ assert len(gender.allowed_items) == 3
+ assert gender.allowed_items[0].label == "female"
+ assert gender.allowed_items[1].label == "male"
+ assert gender.prop_type == PropertyType.UPK_ITEM
+ assert gender.categories[0].label == "Demographic"
+
+ age = [
+ x
+ for x in props
+ if x.country_iso == "us"
+ and x.property_id == "94f7379437874076b345d76642d4ce6d"
+ ]
+ assert len(age) == 1
+ age = age[0]
+ assert age.allowed_items is None
+ assert age.prop_type == PropertyType.UPK_NUMERICAL
+ assert age.gold_standard
+
+ cars = [
+ x
+ for x in props
+ if x.country_iso == "us" and x.property_label == "household_auto_type"
+ ][0]
+ assert not cars.gold_standard
+ assert cars.categories[0].label == "Autos & Vehicles"