In this section
- Test Evidence Boundary test · solar-electrical-topology-analysis-engine-text-based / tests/test_evidence_boundary.py lines 1–127
- Test Formulas test · solar-electrical-topology-analysis-engine-text-based / tests/test_formulas.py lines 1–203
- Test Geometry Authority test · solar-electrical-topology-analysis-engine-text-based / tests/test_geometry_authority.py lines 1–105
- Test Identifiers test · solar-electrical-topology-analysis-engine-text-based / tests/test_identifiers.py lines 1–67
- Test Installed Array API test · solar-electrical-topology-analysis-engine-text-based / tests/test_installed_array_api.py lines 1–94
Test Evidence Boundary
A test in the tests folder of Solar Electrical Topology Analysis Engine Text Based.
testsolar-electrical-topology-analysis-engine-text-based / tests/test_evidence_boundary.py · lines 1–127 of 127 · Entry point · pattern _source (shared by 5 files)
- What it does
- It tests its inputs. Defines 6 functions or classes, including _source, test_public_observation_is_publishable, test_confidential_source_cannot_be_marked_public, test_confidential_only_result_is_blocked, test_confidential_context_can_coexist_with_independent_public_support. Uses libraries pytest, solar_topology.circuit, solar_topology.evidence, solar_topology.evidence_boundary.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (repository name word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Downstream impact
- Used directly by 1 file: Build 025 Small Gates Workflow (solar-electrical-topology-analysis-engine-text-based).
- What it achieves
- Defines `test_public_observation_is_publishable`, `test_confidential_source_cannot_be_marked_public`, `test_confidential_only_result_is_blocked` and 2 more.
- Why it matters
- Run by Build 025 Small Gates Workflow.
- Application
- solar-electrical-topology-analysis-engine-text-based · tests · test
- Uses
- pytest, solar_topology.circuit, solar_topology.evidence, solar_topology.evidence_boundary
- Used by
- run by Build 025 Small Gates Workflow (workflow run)
- Produces
- test_public_observation_is_publishable, test_confidential_source_cannot_be_marked_public, test_confidential_only_result_is_blocked, test_confidential_context_can_coexist_with_independent_public_support, test_restricted_source_without_public_path_blocks_mixed_export
- Defines here
- _source, test_public_observation_is_publishable, test_confidential_source_cannot_be_marked_public, test_confidential_only_result_is_blocked, test_confidential_context_can_coexist_with_independent_public_support, test_restricted_source_without_public_path_blocks_mixed_export
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 tests/test_evidence_boundary.py:1-127 · blob 55ac4b15832befc9fe9ddfcc63201420369a676f · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import pytest
from solar_topology.circuit import EvidenceClass
from solar_topology.evidence import canonical_evidence_descriptor
from solar_topology.evidence_boundary import (
EvidenceSource,
PublicationPermission,
RightsStatus,
assess_publication_boundary,
require_publication_boundary,
)
def _source(
source_id,
evidence_class,
rights_status,
permission,
*,
independent_public_support=False,
):
return EvidenceSource(
source_id=source_id,
descriptor=canonical_evidence_descriptor(evidence_class),
rights_status=rights_status,
publication_permission=permission,
independent_public_support=independent_public_support,
)
def test_public_observation_is_publishable():
decision = assess_publication_boundary(
[
_source(
"public:aerial-imagery",
EvidenceClass.PUBLIC_OBSERVATION,
RightsStatus.PUBLIC,
PublicationPermission.PUBLIC,
)
]
)
assert decision.publishable
assert decision.public_source_ids == ("public:aerial-imagery",)
assert decision.restricted_source_ids == ()
def test_confidential_source_cannot_be_marked_public():
with pytest.raises(ValueError, match="confidential NDA"):
_source(
"nda:sld",
EvidenceClass.EXTERNAL_REFERENCE,
RightsStatus.CONFIDENTIAL_NDA,
PublicationPermission.PUBLIC,
)
def test_confidential_only_result_is_blocked():
source = _source(
"nda:employers-requirements",
EvidenceClass.EXTERNAL_REFERENCE,
RightsStatus.CONFIDENTIAL_NDA,
PublicationPermission.INTERNAL_ONLY,
)
decision = assess_publication_boundary([source])
assert not decision.publishable
assert decision.public_source_ids == ()
assert decision.restricted_source_ids == ("nda:employers-requirements",)
with pytest.raises(PermissionError, match="public export blocked"):
require_publication_boundary([source])
def test_confidential_context_can_coexist_with_independent_public_support():
sources = [
_source(
"public:planning-layout",
EvidenceClass.PUBLIC_OBSERVATION,
RightsStatus.PUBLIC,
PublicationPermission.PUBLIC,
),
_source(
"nda:sld",
EvidenceClass.EXTERNAL_REFERENCE,
RightsStatus.CONFIDENTIAL_NDA,
PublicationPermission.INTERNAL_ONLY,
independent_public_support=True,
),
_source(
"derived:loop-geometry",
EvidenceClass.DERIVED,
RightsStatus.PUBLIC,
PublicationPermission.PUBLIC,
),
]
decision = require_publication_boundary(sources)
assert decision.publishable
assert decision.public_source_ids == (
"derived:loop-geometry",
"public:planning-layout",
)
assert decision.restricted_source_ids == ("nda:sld",)
def test_restricted_source_without_public_path_blocks_mixed_export():
sources = [
_source(
"public:press-release",
EvidenceClass.EXTERNAL_REFERENCE,
RightsStatus.PUBLIC,
PublicationPermission.PUBLIC,
),
_source(
"nda:exact-rating",
EvidenceClass.EXTERNAL_REFERENCE,
RightsStatus.CONFIDENTIAL_NDA,
PublicationPermission.INTERNAL_ONLY,
),
]
decision = assess_publication_boundary(sources)
assert not decision.publishable
assert any("nda:exact-rating" in reason for reason in decision.reasons)Test Formulas
A test in the tests folder of Solar Electrical Topology Analysis Engine Text Based.
testsolar-electrical-topology-analysis-engine-text-based / tests/test_formulas.py · lines 1–203 of 203 · Entry point
- What it does
- It tests its inputs. Defines 11 functions or classes, including test_nominal_csa_is_not_used_to_invent_conductor_diameter, test_two_wire_internal_inductance_is_low_frequency_energy_only, test_velocity_identity_uses_external_inductance_only, test_acosh_domain_guard_rejects_overlapping_conductors, test_rank_pitch_has_no_walkway_allowance. Uses libraries inspect, math, pytest, solar_topology.formulas.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (repository name word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Downstream impact
- Used directly by 1 file: Build 025 Small Gates Workflow (solar-electrical-topology-analysis-engine-text-based).
- What it achieves
- Defines `test_nominal_csa_is_not_used_to_invent_conductor_diameter`, `test_two_wire_internal_inductance_is_low_frequency_energy_only`, `test_velocity_identity_uses_external_inductance_only` and 8 more.
- Why it matters
- Run by Build 025 Small Gates Workflow.
- Application
- solar-electrical-topology-analysis-engine-text-based · tests · test
- Uses
- inspect, math, pytest, solar_topology.formulas
- Used by
- run by Build 025 Small Gates Workflow (workflow run)
- Produces
- test_nominal_csa_is_not_used_to_invent_conductor_diameter, test_two_wire_internal_inductance_is_low_frequency_energy_only, test_velocity_identity_uses_external_inductance_only, test_acosh_domain_guard_rejects_overlapping_conductors, test_rank_pitch_has_no_walkway_allowance, test_route_length_is_derived_from_geometry_only, test_user_cannot_supply_final_route_length, test_declared_finished_cable_resistance_at_temperature, test_declared_complete_circuit_canary_worst_case_compliant, test_module_frame_capacitance_parallel_plate, test_cold_voc_30_module_default
- Defines here
- test_nominal_csa_is_not_used_to_invent_conductor_diameter, test_two_wire_internal_inductance_is_low_frequency_energy_only, test_velocity_identity_uses_external_inductance_only, test_acosh_domain_guard_rejects_overlapping_conductors, test_rank_pitch_has_no_walkway_allowance, test_route_length_is_derived_from_geometry_only, test_user_cannot_supply_final_route_length, test_declared_finished_cable_resistance_at_temperature, test_declared_complete_circuit_canary_worst_case_compliant, test_module_frame_capacitance_parallel_plate, test_cold_voc_30_module_default
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 tests/test_formulas.py:1-203 · blob a907f2b37ba159c5e4408a5b90e0f88365234be1 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import inspect
import math
import pytest
import solar_topology.formulas as formulas
from solar_topology.formulas import (
EPS0,
MU0,
Q_,
cold_string_voc,
dc_resistance,
derived_route_length,
module_frame_capacitance,
two_wire_parameters,
ureg,
)
def test_nominal_csa_is_not_used_to_invent_conductor_diameter():
assert not hasattr(formulas, "conductor_diameter_from_area")
parameters = inspect.signature(two_wire_parameters).parameters
assert "conductor_diameter" in parameters
assert "area" not in parameters
assert "nominal_csa" not in parameters
def test_two_wire_internal_inductance_is_low_frequency_energy_only():
parameters = two_wire_parameters(
Q_(20, ureg.mm),
Q_(3.00, ureg.mm),
2.3,
)
expected_internal = 1e-7
actual_internal = parameters.internal_inductance_per_length.to(
ureg.H / ureg.m
).magnitude
assert actual_internal == pytest.approx(expected_internal)
assert (
parameters.inductance_per_length
> parameters.external_inductance_per_length
)
def test_velocity_identity_uses_external_inductance_only():
epsilon_r = 2.3
parameters = two_wire_parameters(
Q_(20, ureg.mm),
Q_(3.00, ureg.mm),
epsilon_r,
)
expected_velocity = (
1 / (MU0 * EPS0 * epsilon_r) ** 0.5
).to(ureg.m / ureg.s)
actual = parameters.propagation_velocity.to(ureg.m / ureg.s).magnitude
expected = expected_velocity.magnitude
assert actual / expected == pytest.approx(1.0, rel=1e-12)
expected_impedance = (
parameters.external_inductance_per_length
/ parameters.capacitance_per_length
) ** 0.5
assert parameters.characteristic_impedance.to(
ureg.ohm
).magnitude == pytest.approx(
expected_impedance.to(ureg.ohm).magnitude,
rel=1e-12,
)
def test_acosh_domain_guard_rejects_overlapping_conductors():
with pytest.raises(
ValueError,
match="centre spacing must exceed conductor diameter",
):
two_wire_parameters(
Q_(3.00, ureg.mm),
Q_(3.00, ureg.mm),
2.3,
)
def test_rank_pitch_has_no_walkway_allowance():
module_length = Q_(2.384, ureg.m)
clamp_gap = Q_(0.020, ureg.m)
rank_pitch = module_length + clamp_gap
assert rank_pitch.magnitude == pytest.approx(2.404)
def test_route_length_is_derived_from_geometry_only():
length = derived_route_length(
Q_(39.67, ureg.m),
4,
Q_(2.404, ureg.m),
Q_(2, ureg.m),
)
assert length.to(ureg.m).magnitude == pytest.approx(51.286)
parameters = inspect.signature(derived_route_length).parameters
assert "route_length" not in parameters
assert "user_length" not in parameters
def test_user_cannot_supply_final_route_length():
with pytest.raises(TypeError):
derived_route_length(
Q_(0, ureg.m),
0,
Q_(2.404, ureg.m),
Q_(2, ureg.m),
route_length=Q_(999, ureg.m),
)
def test_declared_finished_cable_resistance_at_temperature():
resistance = dc_resistance(
Q_(100, ureg.m),
Q_(3.39e-3, ureg.ohm / ureg.m),
Q_(70, ureg.degC),
)
expected = 100 * 3.39e-3 * (1 + 0.00393 * 50)
assert resistance.to(ureg.ohm).magnitude == pytest.approx(
expected,
rel=1e-12,
)
def test_declared_complete_circuit_canary_worst_case_compliant():
external = dc_resistance(
Q_(59.67, ureg.m),
Q_(3.39e-3, ureg.ohm / ureg.m),
Q_(70, ureg.degC),
)
module_leads = dc_resistance(
Q_(21.0, ureg.m),
Q_(5.09e-3, ureg.ohm / ureg.m),
Q_(75, ureg.degC),
)
connector_contacts = Q_(
62 * 0.35e-3 * (1 + 0.00393 * 55),
ureg.ohm,
)
total = external + module_leads + connector_contacts
current = Q_(17.35, ureg.ampere)
string_vmp = Q_(30 * 38.1, ureg.volt)
voltage_drop = current * total
power_loss = current**2 * total
drop_percent = 100 * voltage_drop / string_vmp
assert total.to(ureg.ohm).magnitude == pytest.approx(
0.39841430395,
rel=1e-10,
)
assert voltage_drop.to(ureg.volt).magnitude == pytest.approx(
6.91248817353,
rel=1e-10,
)
assert drop_percent.to_base_units().magnitude == pytest.approx(
0.604767119294,
rel=1e-9,
)
assert power_loss.to(ureg.watt).magnitude == pytest.approx(
119.931669811,
rel=1e-9,
)
def test_module_frame_capacitance_parallel_plate():
capacitance = module_frame_capacitance(
Q_(1.303 * 2.384, ureg.m**2),
Q_(2, ureg.mm),
6,
)
expected = 8.8541878128e-12 * 6 * (1.303 * 2.384) / 0.002
assert capacitance.to(ureg.F).magnitude == pytest.approx(
expected,
rel=1e-12,
)
def test_cold_voc_30_module_default():
voltage = cold_string_voc(
Q_(45.9, ureg.V),
30,
-0.25,
Q_(-10, ureg.degC),
)
assert voltage.to(ureg.V).magnitude == pytest.approx(
30 * 45.9 * 1.0875
)Test Geometry Authority
A test in the tests folder of Solar Electrical Topology Analysis Engine Text Based that checks Geometry Authority.
testsolar-electrical-topology-analysis-engine-text-based / tests/test_geometry_authority.py · lines 1–105 of 105 · Entry point
- What it does
- It tests its inputs. Defines 9 functions or classes, including test_reference_table_places_720_unique_modules, test_reference_geometry_is_deterministic, test_moving_origin_changes_coordinates_and_hash, test_rotation_changes_geometry_without_changing_module_count, test_landscape_orientation_swaps_module_envelope. Uses libraries math, pytest.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (repository name word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Downstream impact
- Used directly by 1 file: Build 025 Small Gates Workflow (solar-electrical-topology-analysis-engine-text-based).
- What it achieves
- Defines `test_reference_table_places_720_unique_modules`, `test_reference_geometry_is_deterministic`, `test_moving_origin_changes_coordinates_and_hash` and 6 more.
- Why it matters
- Run by Build 025 Small Gates Workflow.
- Application
- solar-electrical-topology-analysis-engine-text-based · tests · test
- Uses
- Geometry Authority (import), math, pytest
- Used by
- run by Build 025 Small Gates Workflow (workflow run)
- Produces
- test_reference_table_places_720_unique_modules, test_reference_geometry_is_deterministic, test_moving_origin_changes_coordinates_and_hash, test_rotation_changes_geometry_without_changing_module_count, test_landscape_orientation_swaps_module_envelope, test_partial_final_row_is_supported, test_public_request_type_exists, test_invalid_capacity_is_rejected, test_non_finite_geometry_is_rejected
- Defines here
- test_reference_table_places_720_unique_modules, test_reference_geometry_is_deterministic, test_moving_origin_changes_coordinates_and_hash, test_rotation_changes_geometry_without_changing_module_count, test_landscape_orientation_swaps_module_envelope, test_partial_final_row_is_supported, test_public_request_type_exists, test_invalid_capacity_is_rejected, test_non_finite_geometry_is_rejected
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 tests/test_geometry_authority.py:1-105 · blob 415d7364801721837660e247ae7b91a93a1d4a96 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import math
import pytest
from geometry_authority import (
ModuleDimensions,
Point2D,
TableLayoutRequest,
generate_table_geometry,
reference_24_by_30_table,
)
def test_reference_table_places_720_unique_modules() -> None:
receipt = reference_24_by_30_table()
assert receipt.module_count == 720
assert len(receipt.placements) == 720
assert len({placement.module_id for placement in receipt.placements}) == 720
assert receipt.placements[0].row_index == 0
assert receipt.placements[0].column_index == 0
assert receipt.placements[-1].row_index == 23
assert receipt.placements[-1].column_index == 29
def test_reference_geometry_is_deterministic() -> None:
first = reference_24_by_30_table()
second = reference_24_by_30_table()
assert first == second
assert first.geometry_hash == second.geometry_hash
def test_moving_origin_changes_coordinates_and_hash() -> None:
original = reference_24_by_30_table()
moved = reference_24_by_30_table(origin=Point2D(100.0, -25.0))
assert moved.placements[0].centre.x_m == pytest.approx(original.placements[0].centre.x_m + 100.0)
assert moved.placements[0].centre.y_m == pytest.approx(original.placements[0].centre.y_m - 25.0)
assert moved.geometry_hash != original.geometry_hash
def test_rotation_changes_geometry_without_changing_module_count() -> None:
original = reference_24_by_30_table()
rotated = reference_24_by_30_table(rotation_deg=90.0)
assert rotated.module_count == original.module_count
assert rotated.geometry_hash != original.geometry_hash
assert rotated.placements[0].centre.x_m == pytest.approx(-original.placements[0].centre.y_m)
assert rotated.placements[0].centre.y_m == pytest.approx(original.placements[0].centre.x_m)
def test_landscape_orientation_swaps_module_envelope() -> None:
request = TableLayoutRequest(
table_id="LANDSCAPE",
module_count=1,
rows=1,
columns=1,
module_dimensions=ModuleDimensions(width_m=1.0, height_m=2.0),
orientation="landscape",
)
receipt = generate_table_geometry(request)
placement = receipt.placements[0]
assert placement.width_m == pytest.approx(2.0)
assert placement.height_m == pytest.approx(1.0)
assert receipt.bounds.max_x_m - receipt.bounds.min_x_m == pytest.approx(2.0)
assert receipt.bounds.max_y_m - receipt.bounds.min_y_m == pytest.approx(1.0)
def test_partial_final_row_is_supported() -> None:
receipt = generate_table_geometry(
TableLayoutRequest(
table_id="PARTIAL",
module_count=7,
rows=2,
columns=4,
module_dimensions=ModuleDimensions(width_m=1.0, height_m=2.0),
)
)
assert len(receipt.placements) == 7
assert receipt.placements[-1].row_index == 1
assert receipt.placements[-1].column_index == 2
def test_public_request_type_exists() -> None:
assert TableLayoutRequest.__name__ == "TableLayoutRequest"
def test_invalid_capacity_is_rejected() -> None:
with pytest.raises(ValueError, match="cannot contain"):
TableLayoutRequest(
table_id="INVALID",
module_count=5,
rows=1,
columns=4,
module_dimensions=ModuleDimensions(width_m=1.0, height_m=2.0),
)
def test_non_finite_geometry_is_rejected() -> None:
with pytest.raises(ValueError, match="finite"):
Point2D(math.inf, 0.0)Test Identifiers
A test in the tests folder of Solar Electrical Topology Analysis Engine Text Based.
testsolar-electrical-topology-analysis-engine-text-based / tests/test_identifiers.py · lines 1–67 of 67 · Entry point
- What it does
- It tests its inputs. Defines 8 functions or classes, including _full_identifier, test_identifier_builds_deterministic_contiguous_path, test_identifier_round_trip, test_identifier_rejects_noncanonical_tokens, test_identifier_rejects_skipped_hierarchy_level. Uses libraries pytest, solar_topology.identifiers.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (repository name word 'solar'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Downstream impact
- Used directly by 1 file: Build 025 Small Gates Workflow (solar-electrical-topology-analysis-engine-text-based).
- What it achieves
- Defines `test_identifier_builds_deterministic_contiguous_path`, `test_identifier_round_trip`, `test_identifier_rejects_noncanonical_tokens` and 4 more.
- Why it matters
- Run by Build 025 Small Gates Workflow.
- Application
- solar-electrical-topology-analysis-engine-text-based · tests · test
- Uses
- pytest, solar_topology.identifiers
- Used by
- run by Build 025 Small Gates Workflow (workflow run)
- Produces
- test_identifier_builds_deterministic_contiguous_path, test_identifier_round_trip, test_identifier_rejects_noncanonical_tokens, test_identifier_rejects_skipped_hierarchy_level, test_parser_rejects_noncontiguous_hierarchy, test_uniqueness_gate_rejects_duplicates, test_identical_local_ids_are_allowed_under_distinct_parents
- Defines here
- _full_identifier, test_identifier_builds_deterministic_contiguous_path, test_identifier_round_trip, test_identifier_rejects_noncanonical_tokens, test_identifier_rejects_skipped_hierarchy_level, test_parser_rejects_noncontiguous_hierarchy, test_uniqueness_gate_rejects_duplicates, test_identical_local_ids_are_allowed_under_distinct_parents
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 tests/test_identifiers.py:1-67 · blob ff172cf052e3968ad133036d4e45450c1daebebe · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: transform · effects: none found · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
import pytest
from solar_topology.identifiers import (
CanonicalIdentifier,
EntityLevel,
parse_identifier,
project_id,
require_unique_identifiers,
)
def _full_identifier():
project = project_id("public-cleve-hill-study")
site = project.child(EntityLevel.SITE, "site-001")
system = site.child(EntityLevel.SYSTEM, "dc-array")
equipment = system.child(EntityLevel.EQUIPMENT, "inverter-001")
circuit = equipment.child(EntityLevel.CIRCUIT, "mppt-01-string-01")
return circuit.child(EntityLevel.OBJECT, "segment-001")
def test_identifier_builds_deterministic_contiguous_path():
identifier = _full_identifier()
assert identifier.value == (
"project:public-cleve-hill-study/site:site-001/system:dc-array/"
"equipment:inverter-001/circuit:mppt-01-string-01/object:segment-001"
)
def test_identifier_round_trip():
identifier = _full_identifier()
parsed = parse_identifier(identifier.value)
assert parsed == identifier
assert parsed.value == identifier.value
def test_identifier_rejects_noncanonical_tokens():
with pytest.raises(ValueError, match="lowercase kebab-case"):
project_id("Cleve Hill")
with pytest.raises(ValueError, match="lowercase kebab-case"):
project_id("cleve_hill")
def test_identifier_rejects_skipped_hierarchy_level():
project = project_id("study")
with pytest.raises(ValueError, match="immediately preceding"):
CanonicalIdentifier(EntityLevel.SYSTEM, "dc-array", project)
def test_parser_rejects_noncontiguous_hierarchy():
with pytest.raises(ValueError, match="contiguous"):
parse_identifier("project:study/system:dc-array")
def test_uniqueness_gate_rejects_duplicates():
identifier = _full_identifier()
with pytest.raises(ValueError, match="unique"):
require_unique_identifiers([identifier, identifier])
def test_identical_local_ids_are_allowed_under_distinct_parents():
project = project_id("study")
site_a = project.child(EntityLevel.SITE, "site-a")
site_b = project.child(EntityLevel.SITE, "site-b")
first = site_a.child(EntityLevel.SYSTEM, "dc-array")
second = site_b.child(EntityLevel.SYSTEM, "dc-array")
require_unique_identifiers([first, second])
assert first.value != second.valueTest Installed Array API
A test in the tests folder of Solar Electrical Topology Analysis Engine Text Based that checks Array Engine and Geometry Authority, using SHA-256.
testsolar-electrical-topology-analysis-engine-text-based / tests/test_installed_array_api.py · lines 1–94 of 94 · Entry point
- What it does
- It tests its inputs. Defines test_installed_array_api_exposes_build_025_authority, test_legacy_module_names_resolve_to_packaged_authority, test_compatibility_files_cannot_contain_independent_authority, test_installed_array_api_reconciles_strategy_accounting. Uses libraries __future__, pathlib, sys, pytest, solar_topology.array. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain stage sub33kv_design (path word 'array'): inside-the-fence electrical and civil design below 33kV, which Ventus Ltd states is within its commercial execution boundary.
- Downstream impact
- Used directly by 1 file: Build 025 Small Gates Workflow (solar-electrical-topology-analysis-engine-text-based).
- What it achieves
- Defines `test_installed_array_api_exposes_build_025_authority`, `test_legacy_module_names_resolve_to_packaged_authority`, `test_compatibility_files_cannot_contain_independent_authority` and 1 more.
- Why it matters
- Run by Build 025 Small Gates Workflow.
- Application
- solar-electrical-topology-analysis-engine-text-based · tests · test
- Uses
- Array Engine (import), Geometry Authority (import), __future__, pathlib, sys, pytest, solar_topology.array
- Used by
- run by Build 025 Small Gates Workflow (workflow run)
- Produces
- test_installed_array_api_exposes_build_025_authority, test_legacy_module_names_resolve_to_packaged_authority, test_compatibility_files_cannot_contain_independent_authority, test_installed_array_api_reconciles_strategy_accounting
- Defines here
- test_installed_array_api_exposes_build_025_authority, test_legacy_module_names_resolve_to_packaged_authority, test_compatibility_files_cannot_contain_independent_authority, test_installed_array_api_reconciles_strategy_accounting
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- solar-electrical-topology-analysis-engine-text-based@d3b4c497144c2c9b3e8f0e82117e7e9abe4672b9 tests/test_installed_array_api.py:1-94 · blob 27f089a76c0b34e85a17fed68ded3257498caa78 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: ingest · effects: filesystem · domain stage: sub33kv_design · users: EPC_contractor, ICP_grid_engineer · canonical: production_core
from __future__ import annotations
from pathlib import Path
import sys
import pytest
import array_engine
import geometry_authority
import solar_topology.array as array_api
from solar_topology.array import (
ARRAY_AUTHORITY_MIGRATION_STAGE,
ARRAY_AUTHORITY_STATUS,
COMPATIBILITY_MODULES,
WiringStrategy,
compare_reference_24_by_30,
reference_24_by_30_build,
)
ROOT = Path(__file__).resolve().parents[1]
def test_installed_array_api_exposes_build_025_authority() -> None:
assert ARRAY_AUTHORITY_STATUS == "canonical_candidate"
assert ARRAY_AUTHORITY_MIGRATION_STAGE == "build-025.5-package-authority"
build = reference_24_by_30_build(strategy=WiringStrategy.LEAPFROG)
assert build.geometry.module_count == 720
assert len(build.routing.strings) == 24
assert build.routing.metrics.total_circuit_conductor_length_m > 0
assert build.receipt_hash.startswith("sha256:")
def test_legacy_module_names_resolve_to_packaged_authority() -> None:
assert array_engine is sys.modules[
"solar_topology.array.array_engine"
]
assert geometry_authority is sys.modules[
"solar_topology.array.geometry_authority"
]
assert (
array_engine.compare_reference_24_by_30
is array_api.compare_reference_24_by_30
)
assert geometry_authority.Point2D is array_api.Point2D
assert "/solar_topology/array/" in array_engine.__file__.replace("\\", "/")
assert "/solar_topology/array/" in geometry_authority.__file__.replace(
"\\", "/"
)
def test_compatibility_files_cannot_contain_independent_authority() -> None:
for module_name in COMPATIBILITY_MODULES:
for path in (ROOT / f"{module_name}.py", ROOT / "src" / f"{module_name}.py"):
text = path.read_text(encoding="utf-8")
non_empty = [line for line in text.splitlines() if line.strip()]
assert len(non_empty) <= 2, f"{path} contains more than a compatibility shim"
assert f"solar_topology.array.{module_name}" in text
assert "import *" in text
def test_installed_array_api_reconciles_strategy_accounting() -> None:
comparison = compare_reference_24_by_30()
sequential = comparison.sequential.routing.metrics
leapfrog = comparison.leapfrog.routing.metrics
assert sequential.total_circuit_conductor_length_m == pytest.approx(
2513.328
)
assert leapfrog.total_circuit_conductor_length_m == pytest.approx(
2560.128
)
assert (
sequential.inverter_home_run_length_m
- leapfrog.inverter_home_run_length_m
) == pytest.approx(798.288)
assert (
leapfrog.series_interconnect_length_m
- sequential.series_interconnect_length_m
) == pytest.approx(845.088)
assert (
leapfrog.total_circuit_conductor_length_m
- sequential.total_circuit_conductor_length_m
) == pytest.approx(46.8)
assert (
100
* (
sequential.absolute_enclosed_loop_area_m2
- leapfrog.absolute_enclosed_loop_area_m2
)
/ sequential.absolute_enclosed_loop_area_m2
) == pytest.approx(79.801548963)