Skip to content

Equality of OrderedDict #82

@lucaferranti

Description

@lucaferranti

I am a little confused by the following, is it intentional that == does not take into account the order of keys for OrderedDict?

julia> a1 = OrderedDict(:A => 1, :B => 2, :C => 3)
OrderedDict{Symbol, Int64} with 3 entries:
  :A => 1
  :B => 2
  :C => 3

julia> a2 = OrderedDict(:B => 2, :A => 1, :C => 3)
OrderedDict{Symbol, Int64} with 3 entries:
  :B => 2
  :A => 1
  :C => 3

julia> a1 == a2
true

this is mainly motivated by testing purposes, as I think in tests one wants to check that also the keys order is correct. Well, arguably one can always do

@test all(kv1 == kv2 for (kv1, kv2) in zip(a1, a2))

so maybe it's not a biggie.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingChange breaks behavior and so needs to go into a major release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions