-
-
Notifications
You must be signed in to change notification settings - Fork 167
Book created from a dict discards ordering #219
Copy link
Copy link
Closed
Description
Since Python 3.7, dictionaries preserve order, so I'd expect the following code to pass:
book = pyexcel.Book(
{
"Stuff": [["some", "data", "I", "can't", "parse"]],
"Records": [["record_id"], ["a"], ["b"], ["c"]],
"Quarters": [
["id", "quarter"],
["one", "2021Q1"],
["two", "2021Q2"],
],
}
)
assert list(book.sheet_names()) == ["Stuff", "Records", "Quarters"]Unfortunately it does not.
E AssertionError: assert ['Quarters', ...rds', 'Stuff'] == ['Stuff', 'Re...', 'Quarters']
E At index 0 diff: 'Quarters' != 'Stuff'
E Full diff:
E - ['Stuff', 'Records', 'Quarters']
E + ['Quarters', 'Records', 'Stuff']
I'd expect sheet_names to return the sheet names in the same order as the source dict.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels