Skip to content

Update class generator to skip setting inherited properties in subclass constructor #721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ehennestad
Copy link
Collaborator

@ehennestad ehennestad commented Jun 18, 2025

Motivation

Fixed a bug where the class generator adds a obj.(propertyName) = parsedValue for inherited properties in subclasses. The effect is that the property value is set twice, once in the superclass constructor and second in the subclass constructor. A side effect of this is that validation warnings will be shown twice when setting some properties.

Example for TimeSeries and ElectricalSeries:

Timeseries constructor:

obj.data = p.Results.data;
obj.data_continuity = p.Results.data_continuity;
obj.data_conversion = p.Results.data_conversion;
obj.data_offset = p.Results.data_offset;
obj.data_resolution = p.Results.data_resolution;
obj.data_unit = p.Results.data_unit;

ElectricalSeries constructor:

obj.data = p.Results.data;
obj.data_unit = p.Results.data_unit;

How to test the behavior?

Show here how to reproduce the new behavior (can be a bug fix or a new feature)

Checklist

  • Have you ensured the PR description clearly describes the problem and solutions?
  • Have you checked to ensure that there aren't other open or previously closed Pull Requests for the same change?
  • If this PR fixes an issue, is the first line of the PR description fix #XX where XX is the issue number?

Copy link

codecov bot commented Jun 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.08%. Comparing base (da1aa27) to head (07655d5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #721   +/-   ##
=======================================
  Coverage   95.08%   95.08%           
=======================================
  Files         162      162           
  Lines        5897     5899    +2     
=======================================
+ Hits         5607     5609    +2     
  Misses        290      290           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ehennestad ehennestad marked this pull request as ready for review June 20, 2025 21:13
@ehennestad ehennestad requested a review from bendichter June 20, 2025 21:27
@bendichter bendichter merged commit 61c21f1 into main Jun 20, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants