@@ -39,6 +39,123 @@ def test_notam_list_result_validation(self):
3939 result = NotamListResult .model_validate (payload )
4040 self .assertEqual (result .notams [0 ].id , "n1" )
4141
42+ def test_notam_list_result_accepts_affected_element_semantics (self ):
43+ payload = {
44+ "notams" : [
45+ {
46+ "id" : "11111111-1111-1111-1111-111111111111" ,
47+ "notam_number" : "A1234/26" ,
48+ "location" : "KJFK" ,
49+ "starts_at" : "2026-02-25T10:00:00Z" ,
50+ "ends_at" : "2026-02-26T10:00:00Z" ,
51+ "issued_at" : "2026-02-25T09:00:00Z" ,
52+ "is_estimated" : False ,
53+ "is_permanent" : False ,
54+ "message" : "RWY 11 restrictions" ,
55+ "interpretation" : {
56+ "description" : "Runway operations restricted." ,
57+ "excerpt" : "Runway 11 restrictions in effect." ,
58+ "category" : "AERODROME" ,
59+ "subcategory" : "RUNWAY_OPERATIONS" ,
60+ "affected_elements" : [
61+ {
62+ "type" : "RUNWAY" ,
63+ "identifier" : "11" ,
64+ "effect" : "RESTRICTED" ,
65+ "details" : "Runway 11 restricted to lighter traffic." ,
66+ "subtype" : "DEPARTURE_RUNWAY" ,
67+ "semantics" : {
68+ "scope" : [],
69+ "conditions" : [
70+ {
71+ "dimension" : "operation_phase" ,
72+ "operator" : "IN" ,
73+ "value" : ["TAKEOFF" , "LANDING" ],
74+ "unit" : None ,
75+ "details" : None ,
76+ },
77+ {
78+ "dimension" : "weight" ,
79+ "operator" : "LTE" ,
80+ "value" : {
81+ "kind" : "MEASUREMENT" ,
82+ "raw_string" : "5700KG" ,
83+ "value" : 5700 ,
84+ "unit" : "KG" ,
85+ },
86+ "unit" : "KG" ,
87+ "details" : None ,
88+ },
89+ {
90+ "dimension" : "procedure_capability" ,
91+ "operator" : "EQ" ,
92+ "value" : {
93+ "scheme" : "ILS_CATEGORY" ,
94+ "category" : "CAT_I" ,
95+ "level" : "LVL_1" ,
96+ },
97+ "unit" : None ,
98+ "details" : None ,
99+ },
100+ ],
101+ "exceptions" : [
102+ {
103+ "dimension" : "aircraft_type" ,
104+ "operator" : "IN" ,
105+ "value" : ["HELICOPTER" ],
106+ "unit" : None ,
107+ "details" : None ,
108+ }
109+ ],
110+ "changes" : [
111+ {
112+ "subject" : "PROCEDURE_CAPABILITY" ,
113+ "from" : [
114+ {
115+ "scheme" : "ILS_CATEGORY" ,
116+ "category" : "CAT_II" ,
117+ "level" : "LVL_2" ,
118+ }
119+ ],
120+ "to" : [
121+ {
122+ "scheme" : "ILS_CATEGORY" ,
123+ "category" : "CAT_I" ,
124+ "level" : "LVL_1" ,
125+ }
126+ ],
127+ "details" : "Downgraded due to maintenance." ,
128+ }
129+ ],
130+ "references" : [
131+ {
132+ "relation" : "DEPENDS_ON" ,
133+ "type" : "NOTAM" ,
134+ "identifier" : "A1234/26" ,
135+ }
136+ ],
137+ },
138+ }
139+ ],
140+ "schedules" : [],
141+ },
142+ }
143+ ],
144+ "total_count" : 1 ,
145+ "page" : 1 ,
146+ "per_page" : 30 ,
147+ }
148+
149+ result = NotamListResult .model_validate (payload )
150+ affected = result .notams [0 ].interpretation .affected_elements [0 ]
151+
152+ self .assertEqual (affected .subtype , "DEPARTURE_RUNWAY" )
153+ self .assertEqual (affected .semantics .conditions [0 ].value , ["TAKEOFF" , "LANDING" ])
154+ self .assertEqual (affected .semantics .conditions [1 ].value .value , 5700 )
155+ self .assertEqual (affected .semantics .conditions [2 ].value .scheme , "ILS_CATEGORY" )
156+ self .assertEqual (affected .semantics .changes [0 ].from_ [0 ].category , "CAT_II" )
157+ self .assertEqual (affected .semantics .references [0 ].relation , "DEPENDS_ON" )
158+
42159 def test_required_fields_enforced (self ):
43160 with self .assertRaises (ValidationError ):
44161 NotamListResult .model_validate ({"notams" : []})
0 commit comments