8000 Add DictSubject.get · Issue #51 · bazelbuild/rules_testing · GitHub
[go: up one dir, main page]

Skip to content
Add DictSubject.get #51
@rickeylev

Description

@rickeylev

Currently, only assert functions and .keys() are available. This makes it impossible to access a specific key for custom assertions, which is necessary if a dict has non-trivial values (e.g. a dict of key->provider or structs).

API: get(key, *, factory), e.g.

def foo_test(env):
  foo_info = env.expect.that_dict(...).get("foo", factory=FooInfoSubject.new)

That the get() behavior isn't exactly the same as a regular dict.get is unfortunate, but I can't think of a great name to replace the [] operator.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0