"""Exercise the public development scene reader and its split restrictions."""
from collections import Counter
from diatom_pilot.scaleup_crowded_dataset import ScaleupCrowdedDataset
try:
 ScaleupCrowdedDataset('test')
 raise AssertionError('test split was accepted')
except ValueError:
 pass
d=ScaleupCrowdedDataset('development_training');counts=Counter();ids=set()
for i in range(len(d)):
 x=d[i];assert x['split']=='development_training' and x['background_label_status'].startswith('unknown') and x['visible_support_status']=='undefined';ms=x['projected_weak_supports'];assert ms.shape==(len(x['instances']),768,768) and ms.dtype.name=='bool';assert x['scene_id'] not in ids;ids.add(x['scene_id']);counts[len(x['instances'])]+=1
print('reader checked',len(ids),'scenes; instance-count distribution',dict(sorted(counts.items())))
