Skip to content

Commit

Permalink
Add test that shape is preserved when exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Feb 23, 2022
1 parent db27df8 commit 75b5977
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion qcodes/tests/dataset/test_database_extract_runs.py
Expand Up @@ -21,14 +21,19 @@
load_by_run_spec,
)
from qcodes.dataset.database_extract_runs import extract_runs_into_db
from qcodes.dataset.experiment_container import Experiment, load_experiment_by_name
from qcodes.dataset.experiment_container import (
Experiment,
load_experiment_by_name,
load_or_create_experiment,
)
from qcodes.dataset.linked_datasets.links import Link
from qcodes.dataset.measurements import Measurement
from qcodes.dataset.sqlite.connection import path_to_dbfile
from qcodes.dataset.sqlite.database import get_db_version_and_newest_available_version
from qcodes.dataset.sqlite.queries import get_experiments
from qcodes.tests.common import error_caused_by
from qcodes.tests.instrument_mocks import DummyInstrument
from qcodes.utils.dataset.doNd import do1d


@contextmanager
Expand Down Expand Up @@ -177,6 +182,26 @@ def test_basic_extraction(two_empty_temp_db_connections, some_interdeps):
extract_runs_into_db(source_path, target_path, source_dataset.run_id)


def test_real_dataset(two_empty_temp_db_connections, inst):
source_conn, target_conn = two_empty_temp_db_connections

source_path = path_to_dbfile(source_conn)
target_path = path_to_dbfile(target_conn)

source_exp = load_or_create_experiment(experiment_name="myexp", conn=source_conn)

source_dataset, a, b = do1d(inst.back, 0, 1, 10, 0, inst.plunger, exp=source_exp)

extract_runs_into_db(source_path, target_path, source_dataset.run_id)

target_dataset = load_by_guid(source_dataset.guid, conn=target_conn)

assert source_dataset.the_same_dataset_as(target_dataset)
# explicit regression test for https://github.com/QCoDeS/Qcodes/issues/3953
assert source_dataset.description.shapes == {"extract_run_inst_plunger": (10,)}
assert source_dataset.description.shapes == target_dataset.description.shapes


def test_correct_experiment_routing(two_empty_temp_db_connections,
some_interdeps):
"""
Expand Down

0 comments on commit 75b5977

Please sign in to comment.