#!/usr/bin/env python3 """Offline smoke test of Site Studio's width-mode example.""" from pathlib import Path import yaml p = Path(__file__).resolve().parents[1] theme = yaml.safe_load((p/'theme.yaml').read_text()) c = theme['overrides']['ui']['container'] assert c['mode'] in {'boxed','fluid','full'} assert 720 <= c['max_width'] <= 1920 assert all(isinstance(x,int) and 0<=x<=96 for x in c['gutter'].values()) raw=(p/'pages/index.md').read_text() yaml_text=raw[4:].split('\n---\n')[0] blocks=yaml.safe_load(yaml_text)['regions']['main'] assert blocks[0]['layout']=={'section_width':'full','content_width':'boxed'} assert blocks[1]['layout']=={'section_width':'fluid','content_width':'fluid'} assert blocks[-1]['layout']=={'section_width':'full','content_width':'boxed'} index=(p/'preview-dist/index.html').read_text() for mode in ['data-section-width="full" data-content-width="boxed"','data-section-width="fluid" data-content-width="fluid"']: assert mode in index print('Container settings and preview: OK')