def test_colors_config_merging(self): with WithConfigTree(mdc(main_tree(), { '2/colors': { 'colors': { 'c1': 3, } }, })) as p: self.assertRenderEqual(p, '{32} bt{2-}#>{--}') with WithConfigTree(mdc(main_tree(), { '2/colors': { 'colors': { 'c1': 3, } }, '3/colors': { 'colors': { 'c1': 4, } }, })) as p: self.assertRenderEqual(p, '{42} bt{2-}#>{--}') with WithConfigTree(mdc(main_tree(), { '2/colors': { 'colors': { 'c1': 3, } }, '3/colors': { 'colors': { 'c2': 4, } }, })) as p: self.assertRenderEqual(p, '{34} bt{4-}#>{--}')
def test_root_config_merging(self): with WithConfigTree( mdc(main_tree(), { '2/config': { 'common': { 'default_top_theme': 'other1', } }, })) as p: self.assertRenderEqual(p, '{12} bt{2-}!>{--}') with WithConfigTree( mdc( main_tree(), { '2/config': { 'common': { 'default_top_theme': 'other1', } }, '3/config': { 'common': { 'default_top_theme': 'other2', } }, })) as p: self.assertRenderEqual(p, '{12} bt{2-}>>{--}')
def test_colorschemes_merging(self): with WithConfigTree(mdc(main_tree(), { '2/colorschemes/default': { 'groups': { 'g': {'fg': 'c2', 'bg': 'c1', 'attr': []}, } }, })) as p: self.assertRenderEqual(p, '{21} bt{1-}#>{--}')
def test_theme_merging(self): with WithConfigTree(mdc(main_tree(), { '2/themes/test/default': { 'segment_data': { 's': { 'after': 'a', } } }, })) as p: self.assertRenderEqual(p, '{12} bta{2-}#>{--}')
def test_root_config_merging(self): with WithConfigTree(mdc(main_tree(), { '2/config': { 'common': { 'default_top_theme': 'other1', } }, })) as p: self.assertRenderEqual(p, '{12} bt{2-}!>{--}') with WithConfigTree(mdc(main_tree(), { '2/config': { 'common': { 'default_top_theme': 'other1', } }, '3/config': { 'common': { 'default_top_theme': 'other2', } }, })) as p: self.assertRenderEqual(p, '{12} bt{2-}>>{--}')
def test_top_theme_merging(self): with WithConfigTree(mdc(main_tree(), { '2/themes/powerline': { 'spaces': 1, }, '3/themes/powerline': { 'dividers': { 'left': { 'hard': '>>', } } }, })) as p: self.assertRenderEqual(p, '{12} bt {2-}>>{--}')
}, }, 'spaces': 0, } main_tree = lambda: { '1/config': root_config(), '1/colors': colors_config(), '1/colorschemes/default': colorscheme_config(), '1/themes/test/default': theme_config(), '1/themes/powerline': top_theme_config(), '1/themes/other1': mdc(top_theme_config(), { 'dividers': { 'left': { 'hard': '!>', } } }), '1/themes/other2': mdc(top_theme_config(), { 'dividers': { 'left': { 'hard': '>>', } } }), } def mkdir_recursive(directory): if os.path.isdir(directory):
main_tree = lambda: { '1/config': root_config(), '1/colors': colors_config(), '1/colorschemes/default': colorscheme_config(), '1/themes/test/default': theme_config(), '1/themes/powerline': top_theme_config(), '1/themes/other1': mdc(top_theme_config(), {'dividers': { 'left': { 'hard': '!>', } }}), '1/themes/other2': mdc(top_theme_config(), {'dividers': { 'left': { 'hard': '>>', } }}), } def mkdir_recursive(directory): if os.path.isdir(directory): return mkdir_recursive(os.path.dirname(directory))