def assert_desired_datasets(case, deployer, desired_manifestations=(), local_datasets=(), local_applications=(), additional_node_config=set(), expected_datasets=(), leases=Leases()):
 calculator = RecordingCalculator(NOTHING_TO_DO)
 deployer = deployer.set(calculator=calculator)
 cluster_configuration = Deployment(nodes=({Node(uuid=deployer.node_uuid, hostname=deployer.hostname, manifestations={manifestation.dataset.dataset_id: manifestation for manifestation in desired_manifestations})} | additional_node_config), leases=leases)
 local_state = BlockDeviceDeployerLocalState(node_uuid=deployer.node_uuid, hostname=deployer.hostname, datasets={dataset.dataset_id: dataset for dataset in local_datasets})
 (node_state, nonmanifest_datasets) = local_state.shared_state_changes()
 cluster_state = DeploymentState(nodes={node_state.set(applications=local_applications)}, nonmanifest_datasets=nonmanifest_datasets.datasets)
 deployer.calculate_changes(configuration=cluster_configuration, cluster_state=cluster_state, local_state=local_state)
 case.assertEqual({dataset.dataset_id: dataset for dataset in expected_datasets}, calculator.desired_datasets)

def assert_desired_datasets ( case , deployer , desired_manifestations = ( ) , local_datasets = ( ) , local_applications = ( ) , additional_node_config = set ( ) , expected_datasets = ( ) , leases = Leases ( ) ) : calculator = RecordingCalculator ( NOTHING_TO_DO ) deployer = deployer . set ( calculator = calculator ) cluster_configuration = Deployment ( nodes = ( { Node ( uuid = deployer . node_uuid , hostname = deployer . hostname , manifestations = { manifestation . dataset . dataset_id : manifestation for manifestation in desired_manifestations } ) } | additional_node_config ) , leases = leases ) local_state = BlockDeviceDeployerLocalState ( node_uuid = deployer . node_uuid , hostname = deployer . hostname , datasets = { dataset . dataset_id : dataset for dataset in local_datasets } ) ( node_state , nonmanifest_datasets ) = local_state . shared_state_changes ( ) cluster_state = DeploymentState ( nodes = { node_state . set ( applications = local_applications ) } , nonmanifest_datasets = nonmanifest_datasets . datasets ) deployer . calculate_changes ( configuration = cluster_configuration , cluster_state = cluster_state , local_state = local_state ) case . assertEqual ( { dataset . dataset_id : dataset for dataset in expected_datasets } , calculator . desired_datasets )
assert that calculate_changes calculates the given desired datasets invoked with the given state and configuration .