Skip to content

Commit c24ed99

Browse files
committed
Misc tidying, documentation clarification
1 parent 865909e commit c24ed99

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

tests/test_utils/test_schemaview.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,8 @@ def test_alias_slot(schema_view_no_imports: SchemaView) -> None:
13321332
13331333
There are three schemas used in these tests:
13341334
1335-
The `range_local` (RL) schema - based on RANGE_DATA["schema_path"]["range_local"]
1335+
The `range_local` (RL) schema
1336+
- based on RANGE_DATA["schema_path"]["range_local"]
13361337
- the default_range value in this schema is referred to as local_default;
13371338
13381339
The `range_importer` (RI) schema, which imports the range_local schema
@@ -1530,11 +1531,10 @@ def sv_range_import_whatever(
15301531
return check_generated_schemaview(sv, range_tuple)
15311532

15321533
# schema that imports the range_importer schema (just specified as text, no need to save it)
1533-
schema_text = f"id: https://example.com/{RII}\nname: {RII}\n"
1534-
schema_text += f"\nimports:\n - {RI}\n\n"
1534+
schema_text = f"id: https://example.com/{RII}\nname: {RII}\nimports:\n - {RI}\n"
15351535

15361536
if import_importer_default:
1537-
schema_text += f"\n\ndefault_range: {import_importer_default}\n\n"
1537+
schema_text += f"\ndefault_range: {import_importer_default}\n\n"
15381538

15391539
sv = SchemaView(schema_text, importmap=importmap)
15401540

@@ -1544,7 +1544,15 @@ def sv_range_import_whatever(
15441544
def check_generated_schemaview(
15451545
sv: SchemaView, range_tuple: tuple[str, str | None, str | None]
15461546
) -> tuple[SchemaView, tuple[str, str | None, str | None]]:
1547-
# post schema generation tests:
1547+
"""Check that the generated SchemaView has the expected default_range values.
1548+
1549+
:param sv: the SchemaView to check
1550+
:type sv: SchemaView
1551+
:param range_tuple: the default_range values for the local, importer, and import_importer schemas
1552+
:type range_tuple: tuple[str, str | None, str | None]
1553+
:return: _description_
1554+
:rtype: tuple[SchemaView, tuple[str, str | None, str | None]]
1555+
"""
15481556
(local_default, importer_default, import_importer_default) = range_tuple
15491557

15501558
sv.all_schema()
@@ -1606,6 +1614,11 @@ def sv_range_riid_gen(request: pytest.FixtureRequest) -> tuple[SchemaView, tuple
16061614
ED = "enum_definition"
16071615
TD = "type_definition"
16081616
# Expected results for the various range tests run in test_slot_range.
1617+
# The values are:
1618+
# - the expected value of slot.range
1619+
# - the expected set of values returned by slot_range_as_union()
1620+
# - the expected set of values returned by induced_slot_range() - COMING SOON!
1621+
# - the expected set of class/enum/type definitions returned by slot_applicable_range_elements()
16091622
ranges_no_defaults = {
16101623
"none_range": [None, set(), set(), ValueError],
16111624
"string_range": ["string", {"string"}, {"string"}, {TD}],
@@ -1637,6 +1650,7 @@ def sv_range_riid_gen(request: pytest.FixtureRequest) -> tuple[SchemaView, tuple
16371650

16381651
# These are the expected ranges for slots where the range is replaced by
16391652
# the default_range of the local, importer, or import_importer schema.
1653+
# Same ordering as ranges_no_defaults.
16401654
ranges_replaced_by_defaults = {
16411655
"none_range": {
16421656
# these tuples replicate what is in RANGE_TUPLES

0 commit comments

Comments
 (0)