Skip to content

F entity role

Timm Fitschen requested to merge f-entity-role into dev

Summary

Fixes unintuitive behavior of "Entity.role" after a retrieval.

(As per the bug report in the CaosDB matrix chat)

  1. When an entity is retrieved with a class (i.e. a subtype of Entity) which does not match the entity role, an exception is being raised.
  2. When an entity is retrieved using the Entity class, the correct role is set and available via Entity.role

Focus

The only real changes are in models.py. See the annotations for more info.

Everything else is just new tests covering the changes.

Test Environment

Check List for the Author

  • All automated tests pass
  • Reference related Issues
  • Up-to-date CHANGELOG.md
  • Annotations in code (Gitlab comments)
    • Intent of new code
    • Problems with old code
    • Why this implementation?

Check List for the Reviewer

  • I understand the intent of this MR
  • All automated tests pass
  • Up-to-date CHANGELOG.md
  • The test environment setup works and the intended behavior is reproducible in the test environment
  • In-code documentation and comments are up-to-date.
  • Check: Are there spezifications? Are they satisfied?
  • remove xfail from pyint test (line 587; test_misc.py): @mark.xfail(reason="Waits for MR https://gitlab.indiscale.com/caosdb/src/caosdb-pylib/-/merge_requests/15")

For further good practices have a look at our review guidelines.

Edited by Alexander Kreft

Merge request reports