Skip to content
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

condense_multiline_comment throws exception when there are empty tags for Ecospold2 extractor #291

Open
tngTUDOR opened this issue Dec 19, 2024 · 0 comments

Comments

@tngTUDOR
Copy link
Contributor

tngTUDOR commented Dec 19, 2024

Current

The Ecospold2DataExtractor silently fails to parse multiline comment tags if they include empty tags.
Example source:

<?xml version="1.0" encoding="utf-8"?>
<ecoSpold xmlns="http://www.EcoInvent.org/EcoSpold02">
  <childActivityDataset>
    <activityDescription>
      <activity id="c40e3c0a-292f-45a5-88cd-ed18265cb7d7" activityNameId="06ffc039-f73b-440c-a5a0-8dc7393a5e71" parentActivityId="0fcbe58d-60b6-46d9-86bf-183d14732a4d" inheritanceDepth="-1" type="1" specialActivityType="0" energyValues="0">
        <activityName xml:lang="en">concrete block production</activityName>
        <includedActivitiesStart xml:lang="en">Includes start stuff</includedActivitiesStart>
        <includedActivitiesEnd xml:lang="en">Includes end stuff</includedActivitiesEnd>
        <generalComment>
          <text xml:lang="en" index="0">Things and stuff and whatnot</text>
          <text xml:lang="en" index="1">a Kikki comment</text>
          <text xml:lang="en" index="2"></text>
        </generalComment>
      </activity>
</xml>

The previous xmls snippet should produce the following string (when using the Ecospold2DataExtractor.condense_multilne_comment() method on it):

"Things and stuff and whatnot\na Kikki comment\n\n"

but it yields an empty string, producing the following diff in the tests:

-     'comment': 'Things and stuff and whatnot\n'
-     'Included activities end:  Includes some stuff\n'
+     'comment': 'Included activities end:  Includes some stuff\n'

Expected

The condense_multiline_comment method of the Ecospold2DataExtractor class should should process correctly "comment" sections in ecospold2 xml files, either by omitting empty "text" tags, or by adding a line break for such.

tngTUDOR added a commit to tngTUDOR/brightway2-io that referenced this issue Dec 19, 2024
tngTUDOR added a commit to tngTUDOR/brightway2-io that referenced this issue Dec 19, 2024
- Update the test expected outcome for brightway-lca#291

Signed-off-by: [email protected]
tngTUDOR added a commit to tngTUDOR/brightway2-io that referenced this issue Dec 19, 2024
- Require the list of strings in the text tags of the comments to be not
  none before the join op

Signed-off-by: [email protected]
tngTUDOR added a commit to tngTUDOR/brightway2-io that referenced this issue Dec 19, 2024
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

No branches or pull requests

1 participant