nuts icon indicating copy to clipboard operation
nuts copied to clipboard

"transformed_result" property of AbstractResultExtractor has several types

Open lucmurer opened this issue 4 years ago • 0 comments

The "transformed_result" property of AbstractResultExtractor has inconsistent types depending on the subclass:

  • In "AbstractHostResultExtractor" it is Dict[str, NutsResult]
  • In "AbstractHostDestResultExtractor" it is Dict[str, Dict[str, NutsResult]]

To me this is an issue due to the following reasons:

  1. The transformed result is a public interface property of the class, at least intended to be used in the per-test created "Extractor" subclass. This could pose a source of confusion
  2. Static type checking is undermined or at least made difficult with these two options.

Possible Solutions to this:

  • Redesign the way the result is passed to the subclasses. This should take into account issue #13 too, to provide a solution matching for both cases. (preferred solution by the author)
  • Extend the annotations to include both values in a type union, but this will not solve problem 2.

lucmurer avatar Nov 17 '21 09:11 lucmurer