Skip to content

DataArray.from_dict: convert docstring code to doctest #6136

Closed
@code-review-doctor

Description

@code-review-doctor

What happened?

This test is passing in a str for dims:

d = {"dims": ("t")}
with pytest.raises(
ValueError, match=r"cannot convert dict without the key 'data'"
):
DataArray.from_dict(d)

dims should be a tuple. I suspect the intent was to specify d = {"dims": ("t",)} when the test was written.

This is small issue, but tests that call functions using the kind of data that would be used in "live" will improve quality of tests. Would be a shame for bug to affect users because tests use a str while in userspace a tuple is used.

What did you expect to happen?

code to be d = {"dims": ("t",)}

Minimal Complete Verifiable Example

No response

Relevant log output

No response

Anything else we need to know?

I'm happy to make a PR to fix this

Environment

NA

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions