NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
49 stars 32 forks source link

Fix inherited readonly props #560

Closed ehennestad closed 4 months ago

ehennestad commented 4 months ago

Motivation

Some schema attributes are redefined to be readonly for inherited classes. In MATLAB a property attribute can not be redefined for subclasses, so it was possible to set readonly properties.

How to test the behavior?

es = types.core.ElectricalSeries()
es.data_unit = 'volt' % works
es.data_unit = 'millivolts' % should not work

Checklist

lawrence-mbf commented 4 months ago

@ehennestad This is not kosher but could you apply the fix mentioned in here: https://github.com/NeurodataWithoutBorders/matnwb/issues/262#issuecomment-1923619681 as most of the errors in these tests come from there.

ehennestad commented 4 months ago

The failed test is actually a good sign!

Error using types.core/ElectricalSeries/validate_data_unit
Unable to set the 'data_unit' property of class '<a href="matlab:doc
types.core.ElectricalSeries">ElectricalSeries</a>' because it is read-only.
codecov[bot] commented 4 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (9d77234) 88.49% compared to head (d8d18f0) 88.52%.

Files Patch % Lines
+file/fillValidators.m 95.83% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #560 +/- ## ========================================== + Coverage 88.49% 88.52% +0.02% ========================================== Files 104 104 Lines 4616 4636 +20 ========================================== + Hits 4085 4104 +19 - Misses 531 532 +1 ```

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