本文整理汇总了Python中tests.lib.config_mock.swap_attributes函数的典型用法代码示例。如果您正苦于以下问题:Python swap_attributes函数的具体用法?Python swap_attributes怎么用?Python swap_attributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了swap_attributes函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_local_themes
def test_local_themes(self):
# Regression test: VimPowerline.add_local_theme did not work properly.
from powerline.vim import VimPowerline
import powerline as powerline_module
with swap_attributes(config, powerline_module):
with get_powerline_raw(config, VimPowerline, replace_gcp=True) as powerline:
powerline.add_local_theme('tests.matchers.always_true', {
'segment_data': {
'foo': {
'contents': '“bar”'
}
},
'segments': {
'left': [
{
'type': 'string',
'name': 'foo',
'highlight_groups': ['g1']
}
]
}
})
window = vim_module.current.window
window_id = 1
winnr = window.number
self.assertEqual(powerline.render(window, window_id, winnr), b'%#Pl_5_12583104_6_32896_NONE#\xc2\xa0\xe2\x80\x9cbar\xe2\x80\x9d%#Pl_6_32896_NONE_None_NONE#>>')
开发者ID:21gunnns,项目名称:powerline,代码行数:26,代码来源:test_configuration.py
示例2: test_term_truecolor_escapes
def test_term_truecolor_escapes(self, config):
from powerline.shell import ShellPowerline
import powerline as powerline_module
config['config']['common']['term_truecolor'] = True
with swap_attributes(config, powerline_module):
with get_powerline_raw(config, ShellPowerline, args=Args(config_path=[''])) as powerline:
self.assertEqual(powerline.render(segment_info={}, side='left'), '\x1b[0;38;2;192;0;192;48;2;0;128;128m\xa0s\x1b[0;38;2;0;128;128;49;22m>>\x1b[0m')
开发者ID:21gunnns,项目名称:powerline,代码行数:7,代码来源:test_configuration.py
示例3: test_fbterm_escapes
def test_fbterm_escapes(self, config):
from powerline.shell import ShellPowerline
import powerline as powerline_module
config['config']['common']['term_escape_style'] = 'fbterm'
with swap_attributes(config, powerline_module):
with get_powerline_raw(config, ShellPowerline, args=Args(config_path=[''])) as powerline:
self.assertEqual(powerline.render(segment_info={}, side='left'), '\x1b[0m\x1b[1;5}\x1b[2;6}\xa0s\x1b[0m\x1b[1;6}\x1b[49m\x1b[22m>>\x1b[0m')
开发者ID:21gunnns,项目名称:powerline,代码行数:7,代码来源:test_configuration.py
示例4: test_screen_escapes
def test_screen_escapes(self, config):
from powerline.shell import ShellPowerline
import powerline as powerline_module
config['config']['common']['additional_escapes'] = 'screen'
with swap_attributes(config, powerline_module):
with get_powerline_raw(config, ShellPowerline, args=Args(config_path=[''])) as powerline:
self.assertEqual(powerline.render(segment_info={}, side='left'), '\x1bP\x1b\x1b[0;38;5;5;48;5;6m\x1b\\\xa0s\x1bP\x1b\x1b[0;38;5;6;49;22m\x1b\\>>\x1bP\x1b\x1b[0m\x1b\\')
开发者ID:21gunnns,项目名称:powerline,代码行数:7,代码来源:test_configuration.py
示例5: test_bar
def test_bar(self):
import powerline as powerline_module
with swap_attributes(config, powerline_module):
with get_powerline_raw(config, powerline_module.Powerline, replace_gcp=True, ext='wm', renderer_module='bar') as powerline:
self.assertRenderEqual(
powerline,
'%{l}%{F#ffc00000}%{B#ff008000}%{+u} A%{F-B--u}%{F#ff008000}%{B#ffc00000}>>%{F-B--u}%{F#ff008000}%{B#ffc00000}B%{F-B--u}%{F#ffc00000}>>%{F-B--u}%{r}%{F#ffc00000}<<%{F-B--u}%{F#ff804000}%{B#ffc00000}%{+u}C%{F-B--u}%{F#ff0000c0}%{B#ffc00000}<<%{F-B--u}%{F#ff008000}%{B#ff0000c0}D %{F-B--u}'
)
开发者ID:21gunnns,项目名称:powerline,代码行数:8,代码来源:test_configuration.py
示例6: test_escapes
def test_escapes(self, config):
from powerline.shell import ShellPowerline
import powerline as powerline_module
with swap_attributes(config, powerline_module):
with get_powerline_raw(
config, ShellPowerline,
args=Args(config_path=[''])) as powerline:
self.assertEqual(
powerline.render(segment_info={}, side='left'),
'\x1b[0;38;5;5;48;5;6m\xa0s\x1b[0;38;5;6;49;22m>>\x1b[0m')
开发者ID:BrianODell,项目名称:dotfiles,代码行数:10,代码来源:test_configuration.py
示例7: test_bar_escape
def test_bar_escape(self, config):
import powerline as powerline_module
config['themes/wm/default']['segments']['left'] = (
highlighted_string('%{asd}', 'hl1'),
highlighted_string('10% %', 'hl2'),
)
with swap_attributes(config, powerline_module):
with get_powerline_raw(config, powerline_module.Powerline, replace_gcp=True, ext='wm', renderer_module='bar') as powerline:
self.assertRenderEqual(
powerline,
'%{l}%{F#ffc00000}%{B#ff008000}%{+u} %%{asd}%{F-B--u}%{F#ff008000}%{B#ffc00000}>>%{F-B--u}%{F#ff008000}%{B#ffc00000}10%% %%%{F-B--u}%{F#ffc00000}>>%{F-B--u}%{r}%{F#ffc00000}<<%{F-B--u}%{F#ff804000}%{B#ffc00000}%{+u}C%{F-B--u}%{F#ff0000c0}%{B#ffc00000}<<%{F-B--u}%{F#ff008000}%{B#ff0000c0}D %{F-B--u}'
)
开发者ID:21gunnns,项目名称:powerline,代码行数:12,代码来源:test_configuration.py
示例8: test_environ_update
def test_environ_update(self):
# Regression test: test that segment obtains environment from vim, not
# from os.environ.
import tests.vim as vim_module
with vim_module._with('globals', powerline_config_paths=['/']):
from powerline.vim import VimPowerline
import powerline as powerline_module
with swap_attributes(config, powerline_module):
with vim_module._with('environ', TEST='abc'):
with get_powerline_raw(config, VimPowerline) as powerline:
window = vim_module.current.window
window_id = 1
winnr = window.number
self.assertEqual(powerline.render(window, window_id, winnr), b'%#Pl_3_8404992_4_192_underline#\xc2\xa0abc%#Pl_4_192_NONE_None_NONE#>>')
vim_module._environ['TEST'] = 'def'
self.assertEqual(powerline.render(window, window_id, winnr), b'%#Pl_3_8404992_4_192_underline#\xc2\xa0def%#Pl_4_192_NONE_None_NONE#>>')
开发者ID:21gunnns,项目名称:powerline,代码行数:16,代码来源:test_configuration.py
示例9: setUpModule
def setUpModule():
global replaces
replaces = swap_attributes(globals(), powerline_module, replaces)
开发者ID:liston,项目名称:Myvimrc,代码行数:3,代码来源:test_config_reload.py
示例10: tearDownModule
def tearDownModule():
global replaces
replaces = swap_attributes(globals(), powerline_module, replaces)
sys.path.pop(0)
开发者ID:wezhang,项目名称:vim-setup,代码行数:4,代码来源:test_configuration.py
示例11: setUpModule
def setUpModule():
global replaces
replaces = swap_attributes(globals(), powerline_module, replaces)
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'path')))
开发者ID:wezhang,项目名称:vim-setup,代码行数:4,代码来源:test_configuration.py
注:本文中的tests.lib.config_mock.swap_attributes函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论