--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/6c898b72-6626-4738-8331-cdee13cff251%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAOMhEnwKOfH4scFO7JKK3nBqZUKj_CP9mV0km6%3D2gw%3D3UiNGQg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAHtu5s8pHEqQEnYcNAXbvSnRRXeciXrQSwmk1OoXZ%2Bn1PyYnUA%40mail.gmail.com.
So essentially you are concerned with this scenario?
```elixir
actual = Map.take(DateTime.utc_now, [:yaer, :month]) # note misspelling
expected = Map.take(%{year: 2017, month: 6, day: 1}, [:yaer, :month]) # same misspelling
assert actual == expected # passes even though we're in 2018
```
I would write that as
```elixir
assert %{yaer: 2018, month: 6} = DateTime.utc_now
```
Which would fail for the correct reason: the misspelling. Fixing this would reveal the test failure that 5 != 6.You'd have similar failures if your tests were correctly spelled, but your data was misspelled or missing keys.I'm not opposed to the idea of a `Map.take!` that raises KeyError. I don't have a use case handy, though.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAAHw6CJkR75u2DVJcj%2BHn47Sx0PG6Acz-KkbvpkxFE9DSATPdg%40mail.gmail.com.