dandi.tests.fixtures

Module Attributes

MINIMAL_PNG

A 1x1 red PNG.

Functions

bids_dandiset(new_dandiset, bids_examples)

bids_dandiset_invalid(new_dandiset, ...)

bids_error_examples(tmp_path_factory)

bids_examples(tmp_path_factory)

bids_nwb_dandiset(new_dandiset, bids_examples)

bids_zarr_dandiset(new_dandiset, bids_examples)

capture_all_logs(caplog)

docker_compose_setup()

get_filtered_gitrepo_fixture(url, whitelist)

get_gitrepo_fixture(url[, committish, ...])

image_files(tmp_path)

local_dandi_api(docker_compose_setup)

new_dandiset(request, sample_dandiset_factory)

nwb_dandiset(new_dandiset, simple2_nwb)

nwb_test_data(tmp_path_factory)

nwbfiles_image_common(image_files)

Create nwbfiles sharing image files.

nwbfiles_image_unique(image_files)

Create nwbfiles linked with unique set of images.

nwbfiles_video_common(video_files)

Create nwbfiles sharing video files.

nwbfiles_video_unique(video_files)

Create nwbfiles linked with unique set of videos.

organized_nwb_dir(simple2_nwb, tmp_path_factory)

organized_nwb_dir2(simple1_nwb_metadata, ...)

organized_nwb_dir3(simple4_nwb, tmp_path_factory)

organized_nwb_dir4(simple4_nwb, simple5_nwb, ...)

Organized NWB directory with one file having one best practice violation, and another file having two best practice violations.

sample_dandiset_factory(local_dandi_api, ...)

simple1_nwb(simple1_nwb_metadata, ...)

simple1_nwb_metadata()

simple2_nwb(simple1_nwb_metadata, ...)

With a subject

simple3_nwb(simple1_nwb_metadata, ...)

With a subject, but no subject_id.

simple4_nwb(tmp_path_factory)

With subject, subject_id, species, but including data orientation ambiguity.

simple5_nwb(tmp_path_factory)

With subject, subject_id, species, but including data orientation ambiguity, and missing the pynwb.Timeseries unit attribute.

text_dandiset(new_dandiset)

tmp_home(monkeypatch, tmp_path_factory)

video_files(request, tmp_path)

zarr_dandiset(new_dandiset)

Classes

DandiAPI(api_key, client)

SampleDandiset(api, dspath, dandiset, ...)

SampleDandisetFactory(local_dandi_api, ...)

class dandi.tests.fixtures.DandiAPI(api_key: 'str', client: 'DandiAPIClient')[source]
api_key: str
property api_url: str
client: DandiAPIClient
property instance: DandiInstance
property instance_id: str
monkeypatch_del_api_key_env(monkeypatch: MonkeyPatch) → None[source]

Monkeypatch to remove the environment variable that provides the API key for accessing the associated DANDI instance.

monkeypatch_set_api_key_env(monkeypatch: MonkeyPatch) → None[source]

Monkeypatch the environment variable that provides the API key for accessing the associated DANDI instance

dandi.tests.fixtures.MINIMAL_PNG = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x02\x00\x00\x00\x90wS\xde\x00\x00\x00\x0cIDATx\x9cc\xf8\xcf\xc0\x00\x00\x03\x01\x01\x00\xc9\xfe\x92\xef\x00\x00\x00\x00IEND\xaeB`\x82'

A 1x1 red PNG. organize never decodes a referenced image, it only relocates the bytes, but writing a real one keeps the fixture from resting on that.

class dandi.tests.fixtures.SampleDandiset(api: 'DandiAPI', dspath: 'Path', dandiset: 'RemoteDandiset', dandiset_id: 'str', upload_kwargs: 'dict[str, Any]'=<factory>)[source]
api: DandiAPI
property client: DandiAPIClient
dandiset: RemoteDandiset
dandiset_id: str
dspath: Path
upload(paths: list[str | Path] | None = None, **kwargs: Any) → None[source]
upload_kwargs: dict[str, Any]
class dandi.tests.fixtures.SampleDandisetFactory(local_dandi_api: 'DandiAPI', tmp_path_factory: 'pytest.TempPathFactory')[source]
local_dandi_api: DandiAPI
mkdandiset(name: str, embargo: bool = False) → SampleDandiset[source]
tmp_path_factory: TempPathFactory
dandi.tests.fixtures.bids_dandiset(new_dandiset: SampleDandiset, bids_examples: Path) → SampleDandiset[source]
dandi.tests.fixtures.bids_dandiset_invalid(new_dandiset: SampleDandiset, bids_error_examples: Path) → SampleDandiset[source]
dandi.tests.fixtures.bids_error_examples(tmp_path_factory: TempPathFactory) → Iterator[Path]
dandi.tests.fixtures.bids_examples(tmp_path_factory: TempPathFactory) → Iterator[Path]
dandi.tests.fixtures.bids_nwb_dandiset(new_dandiset: SampleDandiset, bids_examples: Path) → SampleDandiset[source]
dandi.tests.fixtures.bids_zarr_dandiset(new_dandiset: SampleDandiset, bids_examples: Path) → SampleDandiset[source]
dandi.tests.fixtures.capture_all_logs(caplog: LogCaptureFixture) → None[source]
dandi.tests.fixtures.docker_compose_setup() → Iterator[dict[str, str]][source]
dandi.tests.fixtures.get_filtered_gitrepo_fixture(url: str, whitelist: list[str], make_subdirs_dandisets: bool | None = False) → Callable[[TempPathFactory], Iterator[Path]][source]
dandi.tests.fixtures.get_gitrepo_fixture(url: str, committish: str | None = None, scope: Literal['session', 'package', 'module', 'class', 'function'] = 'session', make_subdirs_dandisets: bool = False) → Callable[[TempPathFactory], Path][source]
dandi.tests.fixtures.image_files(tmp_path: Path) → list[tuple[Path, Path]][source]
dandi.tests.fixtures.local_dandi_api(docker_compose_setup: dict[str, str]) → Iterator[DandiAPI][source]
dandi.tests.fixtures.new_dandiset(request: FixtureRequest, sample_dandiset_factory: SampleDandisetFactory) → SampleDandiset[source]
dandi.tests.fixtures.nwb_dandiset(new_dandiset: SampleDandiset, simple2_nwb: Path) → SampleDandiset[source]
dandi.tests.fixtures.nwb_test_data(tmp_path_factory: TempPathFactory) → Path
dandi.tests.fixtures.nwbfiles_image_common(image_files: list[tuple[Path, Path]]) → Path[source]

Create nwbfiles sharing image files.

dandi.tests.fixtures.nwbfiles_image_unique(image_files: list[tuple[Path, Path]]) → Path[source]

Create nwbfiles linked with unique set of images.

dandi.tests.fixtures.nwbfiles_video_common(video_files: list[tuple[Path, Path]]) → Path[source]

Create nwbfiles sharing video files.

dandi.tests.fixtures.nwbfiles_video_unique(video_files: list[tuple[Path, Path]]) → Path[source]

Create nwbfiles linked with unique set of videos.

dandi.tests.fixtures.organized_nwb_dir(simple2_nwb: Path, tmp_path_factory: TempPathFactory) → Path[source]
dandi.tests.fixtures.organized_nwb_dir2(simple1_nwb_metadata: dict[str, Any], simple2_nwb: Path, tmp_path_factory: TempPathFactory) → Path[source]
dandi.tests.fixtures.organized_nwb_dir3(simple4_nwb: Path, tmp_path_factory: TempPathFactory) → Path[source]
dandi.tests.fixtures.organized_nwb_dir4(simple4_nwb: Path, simple5_nwb: Path, tmp_path_factory: TempPathFactory) → Path[source]

Organized NWB directory with one file having one best practice violation, and another file having two best practice violations.

dandi.tests.fixtures.sample_dandiset_factory(local_dandi_api: DandiAPI, tmp_path_factory: TempPathFactory) → SampleDandisetFactory[source]
dandi.tests.fixtures.simple1_nwb(simple1_nwb_metadata: dict[str, Any], tmp_path_factory: TempPathFactory) → Path[source]
dandi.tests.fixtures.simple1_nwb_metadata() → dict[str, Any][source]
dandi.tests.fixtures.simple2_nwb(simple1_nwb_metadata: dict[str, Any], tmp_path_factory: TempPathFactory) → Path[source]

With a subject

dandi.tests.fixtures.simple3_nwb(simple1_nwb_metadata: dict[str, Any], tmp_path_factory: TempPathFactory) → Path[source]

With a subject, but no subject_id.

dandi.tests.fixtures.simple4_nwb(tmp_path_factory: TempPathFactory) → Path[source]

With subject, subject_id, species, but including data orientation ambiguity.

dandi.tests.fixtures.simple5_nwb(tmp_path_factory: TempPathFactory) → Path[source]

With subject, subject_id, species, but including data orientation ambiguity, and missing the pynwb.Timeseries unit attribute.

Notes

dandi.tests.fixtures.text_dandiset(new_dandiset: SampleDandiset) → SampleDandiset[source]
dandi.tests.fixtures.tmp_home(monkeypatch: MonkeyPatch, tmp_path_factory: TempPathFactory) → Path[source]
dandi.tests.fixtures.video_files(request: FixtureRequest, tmp_path: Path) → list[tuple[Path, Path]][source]
dandi.tests.fixtures.zarr_dandiset(new_dandiset: SampleDandiset) → SampleDandiset[source]