-
Notifications
You must be signed in to change notification settings - Fork 82
Closed
Labels
kind:fixBugs are defects and failure demand.Bugs are defects and failure demand.level:starterSuited for beginners and new contributorsSuited for beginners and new contributors
Description
The following code fails for scalar Enum arrays (without dimension):
if len(array) > 0 and cls.__name__ is array[0].__class__.__name__: |
A real-life example of this bug:
You can reproduce the issue with the following code:
from numpy import array, atleast_1d
from openfisca_core.indexed_enums import Enum
class Greetings(Enum):
hola = "Hola"
chao = "Chao"
greeting = array(Greetings.hola)
greeting.size # 1
len(greeting) # TypeError: len() of unsized object
atleast_1d(greeting).size # 1
len(atleast_1d(greeting)) # 1
What's the expected behaviour here?
- We're expecting an array with at least one dimension.
- We should make sure we cast or take into account scalar arrays.
Metadata
Metadata
Assignees
Labels
kind:fixBugs are defects and failure demand.Bugs are defects and failure demand.level:starterSuited for beginners and new contributorsSuited for beginners and new contributors