@@ -238,3 +238,55 @@ def test_AttachedToFileSet(self) -> None:
238238
239239 self .assertEqual ("15" , fileSet [KeyValueAttribute ]["id1" ])
240240 self .assertEqual ("-5" , file [KeyValueAttribute ]["id1" ])
241+
242+ def test_AttachedToDesign (self ) -> None :
243+ project = Project ("project" , rootDirectory = Path ("project" ))
244+ design = Design ("design" , directory = Path ("designA" ), project = project )
245+ fileSet = FileSet ("fileset" , design = design )
246+ file = File (Path ("file_A1.vhdl" ), fileSet = fileSet )
247+
248+ design [KeyValueAttribute ] = KeyValueAttribute ()
249+
250+ attribute = fileSet [KeyValueAttribute ]
251+ attribute ["id1" ] = "15"
252+ design [KeyValueAttribute ]["id2" ] = "25"
253+
254+ self .assertEqual ("15" , attribute ["id1" ])
255+ self .assertEqual ("15" , fileSet [KeyValueAttribute ]["id1" ])
256+ self .assertEqual ("15" , file [KeyValueAttribute ]["id1" ])
257+
258+ self .assertEqual ("25" , attribute ["id2" ])
259+ self .assertEqual ("25" , fileSet [KeyValueAttribute ]["id2" ])
260+ self .assertEqual ("25" , file [KeyValueAttribute ]["id2" ])
261+
262+ file [KeyValueAttribute ] = KeyValueAttribute ()
263+ file [KeyValueAttribute ]["id1" ] = "-5"
264+
265+ self .assertEqual ("15" , fileSet [KeyValueAttribute ]["id1" ])
266+ self .assertEqual ("-5" , file [KeyValueAttribute ]["id1" ])
267+
268+ def test_AttachedToProject (self ) -> None :
269+ project = Project ("project" , rootDirectory = Path ("project" ))
270+ design = Design ("design" , directory = Path ("designA" ), project = project )
271+ fileSet = FileSet ("fileset" , design = design )
272+ file = File (Path ("file_A1.vhdl" ), fileSet = fileSet )
273+
274+ project [KeyValueAttribute ] = KeyValueAttribute ()
275+
276+ attribute = fileSet [KeyValueAttribute ]
277+ attribute ["id1" ] = "15"
278+ project [KeyValueAttribute ]["id2" ] = "25"
279+
280+ self .assertEqual ("15" , attribute ["id1" ])
281+ self .assertEqual ("15" , fileSet [KeyValueAttribute ]["id1" ])
282+ self .assertEqual ("15" , file [KeyValueAttribute ]["id1" ])
283+
284+ self .assertEqual ("25" , attribute ["id2" ])
285+ self .assertEqual ("25" , fileSet [KeyValueAttribute ]["id2" ])
286+ self .assertEqual ("25" , file [KeyValueAttribute ]["id2" ])
287+
288+ file [KeyValueAttribute ] = KeyValueAttribute ()
289+ file [KeyValueAttribute ]["id1" ] = "-5"
290+
291+ self .assertEqual ("15" , fileSet [KeyValueAttribute ]["id1" ])
292+ self .assertEqual ("-5" , file [KeyValueAttribute ]["id1" ])
0 commit comments