arup-group / genet

Manipulate MATSim networks via a Python API.
MIT License
45 stars 9 forks source link

Fix reading java array type #216

Closed KasiaKoz closed 9 months ago

KasiaKoz commented 11 months ago

Fixes https://github.com/arup-group/genet/issues/220 The java array types were being read to a set with extra unnecessary characters.

E.g. given:

<attribute name="attrib" class="java.lang.Array">{'A', 'B'}</attribute>

would be read to

{"{'A'", " 'B'}"}

This is now fixed to give:

{"A", "B"}

Added a test to catch the problem:

Screenshot 2023-12-18 at 18 10 04
KasiaKoz commented 10 months ago

The bug fix looks good, but I've queried the conversion from list to set - are we okay with losing duplicate elements? Can this cause a problem?

right now we're ok and that's the expected behaviour, we have an issue: https://github.com/arup-group/genet/issues/125 so it's known and if this becomes a problem we can start a debate there on what should happen

Also - is there an issue for this bug?

No, I only noticed it when I looked at another bug, that was documented: https://github.com/arup-group/genet/issues/156

KasiaKoz commented 10 months ago

Made an issue for the bug and updated the PR description

codecov-commenter commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (127fcf0) 92.08% compared to head (d0891cf) 92.08%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #216 +/- ## ======================================= Coverage 92.08% 92.08% ======================================= Files 37 37 Lines 6620 6620 Branches 1588 1588 ======================================= Hits 6096 6096 Misses 305 305 Partials 219 219 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.