当前位置: 首页>>代码示例>>Python>>正文


Python vim._get_segment_info函数代码示例

本文整理汇总了Python中tests.vim._get_segment_info函数的典型用法代码示例。如果您正苦于以下问题:Python _get_segment_info函数的具体用法?Python _get_segment_info怎么用?Python _get_segment_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_get_segment_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_paste_indicator

	def test_paste_indicator(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.paste_indicator(pl=pl, segment_info=segment_info), None)
		with vim_module._with('options', paste=1):
			self.assertEqual(vim.paste_indicator(pl=pl, segment_info=segment_info), 'PASTE')
			self.assertEqual(vim.paste_indicator(pl=pl, segment_info=segment_info, text='P'), 'P')
开发者ID:KinzataDev,项目名称:dotfiles,代码行数:7,代码来源:test_segments.py

示例2: test_readonly_indicator

	def test_readonly_indicator(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.readonly_indicator(pl=pl, segment_info=segment_info), None)
		with vim_module._with('bufoptions', readonly=1):
			self.assertEqual(vim.readonly_indicator(pl=pl, segment_info=segment_info), '')
			self.assertEqual(vim.readonly_indicator(pl=pl, segment_info=segment_info, text='L'), 'L')
开发者ID:KinzataDev,项目名称:dotfiles,代码行数:7,代码来源:test_segments.py

示例3: test_repository_status

	def test_repository_status(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		with replace_attr(vim, 'guess', lambda path: Args(branch=lambda: os.path.basename(path), status=lambda: None, directory=path)):
			self.assertEqual(vim.repository_status(pl=pl, segment_info=segment_info), None)
		with replace_attr(vim, 'guess', lambda path: Args(branch=lambda: os.path.basename(path), status=lambda: 'DU', directory=path)):
			self.assertEqual(vim.repository_status(pl=pl, segment_info=segment_info), 'DU')
开发者ID:DaneelOliwan,项目名称:dotfiles-vim,代码行数:7,代码来源:test_segments.py

示例4: test_cursor_current

	def test_cursor_current(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.line_current(pl=pl, segment_info=segment_info), '1')
		self.assertEqual(vim.col_current(pl=pl, segment_info=segment_info), '1')
		self.assertEqual(vim.virtcol_current(pl=pl, segment_info=segment_info),
				[{'highlight_group': ['virtcol_current', 'col_current'], 'contents': '1'}])
开发者ID:DaneelOliwan,项目名称:dotfiles-vim,代码行数:7,代码来源:test_segments.py

示例5: test_file_directory

	def test_file_directory(self):
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.file_directory(segment_info=segment_info), None)
		with replace_env('HOME', '/home/foo'):
			with vim_module._with('buffer', '/tmp/abc') as segment_info:
				self.assertEqual(vim.file_directory(segment_info=segment_info), '/tmp/')
				os.environ['HOME'] = '/tmp'
				self.assertEqual(vim.file_directory(segment_info=segment_info), '~/')
开发者ID:kovidgoyal,项目名称:powerline,代码行数:8,代码来源:test_segments.py

示例6: test_modified_indicator

	def test_modified_indicator(self):
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.modified_indicator(segment_info=segment_info), None)
		segment_info['buffer'][0] = 'abc'
		try:
			self.assertEqual(vim.modified_indicator(segment_info=segment_info), '+')
			self.assertEqual(vim.modified_indicator(segment_info=segment_info, text='-'), '-')
		finally:
			vim_module._bw(segment_info['bufnr'])
开发者ID:kovidgoyal,项目名称:powerline,代码行数:9,代码来源:test_segments.py

示例7: test_file_opts

	def test_file_opts(self):
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.file_format(segment_info=segment_info),
				[{'divider_highlight_group': 'background:divider', 'contents': 'unix'}])
		self.assertEqual(vim.file_encoding(segment_info=segment_info),
				[{'divider_highlight_group': 'background:divider', 'contents': 'utf-8'}])
		self.assertEqual(vim.file_type(segment_info=segment_info), None)
		with vim_module._with('bufoptions', filetype='python'):
			self.assertEqual(vim.file_type(segment_info=segment_info),
					[{'divider_highlight_group': 'background:divider', 'contents': 'python'}])
开发者ID:kovidgoyal,项目名称:powerline,代码行数:10,代码来源:test_segments.py

示例8: test_mode

	def test_mode(self):
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.mode(segment_info=segment_info), 'NORMAL')
		self.assertEqual(vim.mode(segment_info=segment_info, override={'i': 'INS'}), 'NORMAL')
		self.assertEqual(vim.mode(segment_info=segment_info, override={'n': 'NORM'}), 'NORM')
		with vim_module._with('mode', 'i') as segment_info:
			self.assertEqual(vim.mode(segment_info=segment_info), 'INSERT')
		with vim_module._with('mode', chr(ord('V') - 0x40)) as segment_info:
			self.assertEqual(vim.mode(segment_info=segment_info), 'V·BLCK')
			self.assertEqual(vim.mode(segment_info=segment_info, override={'^V': 'VBLK'}), 'VBLK')
开发者ID:kovidgoyal,项目名称:powerline,代码行数:10,代码来源:test_segments.py

示例9: test_cursor_current

	def test_cursor_current(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.line_current(pl=pl, segment_info=segment_info), '1')
		self.assertEqual(vim.col_current(pl=pl, segment_info=segment_info), '1')
		self.assertEqual(vim.virtcol_current(pl=pl, segment_info=segment_info), [{
			'highlight_group': ['virtcol_current_gradient', 'virtcol_current', 'col_current'], 'contents': '1', 'gradient_level': 100.0 / 80,
		}])
		self.assertEqual(vim.virtcol_current(pl=pl, segment_info=segment_info, gradient=False), [{
			'highlight_group': ['virtcol_current', 'col_current'], 'contents': '1',
		}])
开发者ID:KinzataDev,项目名称:dotfiles,代码行数:11,代码来源:test_segments.py

示例10: test_line_percent

	def test_line_percent(self):
		segment_info = vim_module._get_segment_info()
		segment_info['buffer'][0:-1] = [str(i) for i in range(100)]
		try:
			self.assertEqual(vim.line_percent(segment_info=segment_info), '0')
			vim_module._set_cursor(50, 0)
			self.assertEqual(vim.line_percent(segment_info=segment_info), '49')
			self.assertEqual(vim.line_percent(segment_info=segment_info, gradient=True),
					[{'contents': '49', 'highlight_group': ['line_percent_gradient', 'line_percent'], 'gradient_level': 49}])
		finally:
			vim_module._bw(segment_info['bufnr'])
开发者ID:kovidgoyal,项目名称:powerline,代码行数:11,代码来源:test_segments.py

示例11: test_file_name

	def test_file_name(self):
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.file_name(segment_info=segment_info), None)
		self.assertEqual(vim.file_name(segment_info=segment_info, display_no_file=True),
				[{'contents': '[No file]', 'highlight_group': ['file_name_no_file', 'file_name']}])
		self.assertEqual(vim.file_name(segment_info=segment_info, display_no_file=True, no_file_text='X'),
				[{'contents': 'X', 'highlight_group': ['file_name_no_file', 'file_name']}])
		with vim_module._with('buffer', '/tmp/abc') as segment_info:
			self.assertEqual(vim.file_name(segment_info=segment_info), 'abc')
		with vim_module._with('buffer', '/tmp/’’') as segment_info:
			self.assertEqual(vim.file_name(segment_info=segment_info), '’’')
开发者ID:kovidgoyal,项目名称:powerline,代码行数:11,代码来源:test_segments.py

示例12: test_file_directory

	def test_file_directory(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.file_directory(pl=pl, segment_info=segment_info), None)
		with replace_env('HOME', '/home/foo', os.environ):
			with vim_module._with('buffer', '/tmp/’’/abc') as segment_info:
				self.assertEqual(vim.file_directory(pl=pl, segment_info=segment_info), '/tmp/’’/')
			with vim_module._with('buffer', b'/tmp/\xFF\xFF/abc') as segment_info:
				self.assertEqual(vim.file_directory(pl=pl, segment_info=segment_info), '/tmp/<ff><ff>/')
			with vim_module._with('buffer', '/tmp/abc') as segment_info:
				self.assertEqual(vim.file_directory(pl=pl, segment_info=segment_info), '/tmp/')
				os.environ['HOME'] = '/tmp'
				self.assertEqual(vim.file_directory(pl=pl, segment_info=segment_info), '~/')
开发者ID:liston,项目名称:Myvimrc,代码行数:13,代码来源:test_segments.py

示例13: test_position

	def test_position(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		try:
			segment_info['buffer'][0:-1] = [str(i) for i in range(99)]
			vim_module._set_cursor(49, 0)
			self.assertEqual(vim.position(pl=pl, segment_info=segment_info), '50%')
			self.assertEqual(vim.position(pl=pl, segment_info=segment_info, gradient=True),
					[{'contents': '50%', 'highlight_group': ['position_gradient', 'position'], 'gradient_level': 50.0}])
			vim_module._set_cursor(0, 0)
			self.assertEqual(vim.position(pl=pl, segment_info=segment_info), 'Top')
			vim_module._set_cursor(97, 0)
			self.assertEqual(vim.position(pl=pl, segment_info=segment_info, position_strings={'top': 'Comienzo', 'bottom': 'Final', 'all': 'Todo'}), 'Final')
			segment_info['buffer'][0:-1] = [str(i) for i in range(2)]
			vim_module._set_cursor(0, 0)
			self.assertEqual(vim.position(pl=pl, segment_info=segment_info, position_strings={'top': 'Comienzo', 'bottom': 'Final', 'all': 'Todo'}), 'Todo')
			self.assertEqual(vim.position(pl=pl, segment_info=segment_info, gradient=True),
					[{'contents': 'All', 'highlight_group': ['position_gradient', 'position'], 'gradient_level': 0.0}])
		finally:
			vim_module._bw(segment_info['bufnr'])
开发者ID:liston,项目名称:Myvimrc,代码行数:20,代码来源:test_segments.py

示例14: test_file_size

	def test_file_size(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.file_size(pl=pl, segment_info=segment_info), '0 B')
		with vim_module._with('buffer', os.path.join(os.path.dirname(__file__), 'empty')) as segment_info:
			self.assertEqual(vim.file_size(pl=pl, segment_info=segment_info), '0 B')
开发者ID:KinzataDev,项目名称:dotfiles,代码行数:6,代码来源:test_segments.py

示例15: test_window_title

	def test_window_title(self):
		pl = Pl()
		segment_info = vim_module._get_segment_info()
		self.assertEqual(vim.window_title(pl=pl, segment_info=segment_info), None)
		with vim_module._with('wvars', quickfix_title='Abc'):
			self.assertEqual(vim.window_title(pl=pl, segment_info=segment_info), 'Abc')
开发者ID:liston,项目名称:Myvimrc,代码行数:6,代码来源:test_segments.py


注:本文中的tests.vim._get_segment_info函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。