Skip to content

Commit 1fc9cc0

Browse files
committed
tests: XML round-trip test suite and three serialization bug fixes
Add test_XML_RoundTrip.py covering all property and primitive types via Write2XML/ReadFromXML with non-default values. Three bugs found and fixed: - CSPropProbeBox: Weight/StartTime/StopTime used SetAttribute (int) instead of SetDoubleAttribute, truncating fractional values. - CSProperties: bVisisble was never serialized; SetVisibility(false) was silently lost on re-import. - CSProperties.pyx: CSPropLorentzMaterial weight functions passed Python str to C++ without .encode('UTF-8'), unlike the equivalent Debye code. Signed-off-by: Thorsten Liebig <thorsten.liebig@gmx.de> Generated-by: Claude Sonnet 4.6
1 parent 6f7b971 commit 1fc9cc0

4 files changed

Lines changed: 438 additions & 3 deletions

File tree

python/CSXCAD/CSProperties.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,7 @@ cdef class CSPropLorentzMaterial(CSPropDispersiveMaterial):
15031503
CSPropDispersiveMaterial._GetDispersiveMaterialWeightDir(self, prop_name, order, ny)
15041504

15051505
def _SetDispersiveMaterialWeightDir(self, prop_name, order, ny, val):
1506+
val = val.encode('UTF-8')
15061507
if prop_name == 'eps_plasma':
15071508
return (<_CSPropLorentzMaterial*>self.thisptr).SetEpsPlasmaFreqWeightFunction(order, val, ny)
15081509
elif prop_name == 'eps_pole_freq':

0 commit comments

Comments
 (0)