Skip to content

has_entry with nested matchers does not report excact cause  #156

@dz0

Description

@dz0

Hi, simple example

data = {'level1': {'level2': 2}}
matcher_level2 = has_entries({'level2': 42})

Why has_entry does not display (block) deeper cause?:

assert_that(data, has_entry('level1', matcher_level2))

Expected: a dictionary containing ['level1': a dictionary containing {'level2': <42>}]
     but: was <{'level1': {'level2': 2}}>

As has_entries displays deepest cause:

assert_that(data['level1'], matcher_level2)

Expected: a dictionary containing {'level2': <42>}
     but: value for 'level2' was <2>

assert_that(data, has_entries({'level1': matcher_level2}))

Expected: a dictionary containing {'level1': a dictionary containing {'level2': <42>}}
     but: value for 'level1' value for 'level2' was <2>

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions