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

Unit tests raise NodeIDAbsentError #37

Closed
danielhuppmann opened this issue Mar 14, 2022 · 2 comments · Fixed by #39 or IAMconsortium/pyam#647
Closed

Unit tests raise NodeIDAbsentError #37

danielhuppmann opened this issue Mar 14, 2022 · 2 comments · Fixed by #39 or IAMconsortium/pyam#647

Comments

@danielhuppmann
Copy link
Contributor

  • UNFCCC DI API version: 3.0.0
  • Python version: 3.9
  • Operating System: MacOs 12.2.1

Description

Running the unit tests fails with

    def test_annex_one(api_reader: UNFCCCApiReader):
>       ans = api_reader.annex_one_reader.query(party_codes=["DEU"], gases=["N₂O"])

unfccc_di_api/tests/test_unfccc_di_api.py:25: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
unfccc_di_api/unfccc_di_api.py:438: in query
    df = self._parse_raw_answer(
unfccc_di_api/unfccc_di_api.py:488: in _parse_raw_answer
    "measure": self.measure_tree[variable["measureId"]].tag,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <treelib.tree.Tree object at 0x7fdceba0f880>, key = 19496

    def __getitem__(self, key):
        """Return _nodes[key]"""
        try:
            return self._nodes[key]
        except KeyError:
>           raise NodeIDAbsentError("Node '%s' is not in the tree" % key)
E           treelib.exceptions.NodeIDAbsentError: Node '19496' is not in the tree
@danielhuppmann
Copy link
Contributor Author

Thank you for the quick fix, @mikapfl!

@mikapfl
Copy link
Member

mikapfl commented Mar 15, 2022

Thank you for the thorough bug report! I have released version 3.0.1 which fixes this. It is already on pyPI, but will take a bit until it propagates to conda.

Cheers,

Mika

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants