本文整理汇总了Python中salt.pillar.mysql.merger函数的典型用法代码示例。如果您正苦于以下问题:Python merger函数的具体用法?Python merger怎么用?Python merger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了merger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_001_extract_queries_legacy
def test_001_extract_queries_legacy(self):
return_data = mysql.merger()
args, kwargs = [], {'mysql_query': 'SELECT blah'}
qbuffer = return_data.extract_queries(args, kwargs)
self.assertEqual([
[None, {'query': 'SELECT blah', 'depth': 0, 'as_list': False, 'with_lists': None}]
], qbuffer)
示例2: test_005_extract_queries_bogus_list
def test_005_extract_queries_bogus_list(self):
# This test is specifically checking that empty queries are dropped
return_data = mysql.merger()
args, kwargs = [
'SELECT blah',
'',
'SELECT blah2',
('SELECT blah3',),
('',),
('SELECT blah4', 2),
tuple(),
('SELECT blah5',),
{'query': 'SELECT blah6'},
{'query': ''},
{'query': 'SELECT blah7', 'depth': 2},
{'not_a_query': 'in sight!'},
{'query': 'SELECT blah8', 'as_list': True},
], {}
qbuffer = return_data.extract_queries(args, kwargs)
self.assertEqual([
[None, {'query': 'SELECT blah', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah2', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah3', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah4', 'depth': 2, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah5', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah6', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah7', 'depth': 2, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah8', 'depth': 0, 'as_list': True, 'with_lists': None}]
], qbuffer)
示例3: test_003_extract_queries_kwarg
def test_003_extract_queries_kwarg(self):
return_data = mysql.merger()
args, kwargs = [], {
'1': 'SELECT blah',
'2': 'SELECT blah2',
'3': ('SELECT blah3',),
'4': ('SELECT blah4', 2),
'5': {'query': 'SELECT blah5'},
'6': {'query': 'SELECT blah6', 'depth': 2},
'7': {'query': 'SELECT blah7', 'as_list': True},
}
qbuffer = return_data.extract_queries(args, kwargs)
self.assertEqual([
['1', {'query': 'SELECT blah', 'depth': 0, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
['2', {'query': 'SELECT blah2', 'depth': 0, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
['3', {'query': 'SELECT blah3', 'depth': 0, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
['4', {'query': 'SELECT blah4', 'depth': 2, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
['5', {'query': 'SELECT blah5', 'depth': 0, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
['6', {'query': 'SELECT blah6', 'depth': 2, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
['7', {'query': 'SELECT blah7', 'depth': 0, 'as_list': True,
'with_lists': None, 'ignore_null': False}]
], qbuffer)
示例4: test_002_extract_queries_list
def test_002_extract_queries_list(self):
return_data = mysql.merger()
args, kwargs = [
'SELECT blah',
'SELECT blah2',
('SELECT blah3',),
('SELECT blah4', 2),
{'query': 'SELECT blah5'},
{'query': 'SELECT blah6', 'depth': 2},
{'query': 'SELECT blah7', 'as_list': True},
{'query': 'SELECT blah8', 'with_lists': '1'},
{'query': 'SELECT blah9', 'with_lists': '1,2'}
], {}
qbuffer = return_data.extract_queries(args, kwargs)
self.assertEqual([
[None, {'query': 'SELECT blah', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah2', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah3', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah4', 'depth': 2, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah5', 'depth': 0, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah6', 'depth': 2, 'as_list': False, 'with_lists': None}],
[None, {'query': 'SELECT blah7', 'depth': 0, 'as_list': True, 'with_lists': None}],
[None, {'query': 'SELECT blah8', 'depth': 0, 'as_list': False, 'with_lists': [1]}],
[None, {'query': 'SELECT blah9', 'depth': 0, 'as_list': False, 'with_lists': [1, 2]}]
], qbuffer)
示例5: test_004_extract_queries_mixed
def test_004_extract_queries_mixed(self):
return_data = mysql.merger()
args, kwargs = [
'SELECT blah1',
('SELECT blah2', 2),
{'query': 'SELECT blah3', 'as_list': True},
], {
'1': 'SELECT blah1',
'2': ('SELECT blah2', 2),
'mysql_query': 'SELECT blahm', # In the middle for complexity
'3': {'query': 'SELECT blah3', 'as_list': True},
}
qbuffer = return_data.extract_queries(args, kwargs)
self.assertEqual([
[None, {'query': 'SELECT blahm', 'depth': 0, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
[None, {'query': 'SELECT blah1', 'depth': 0, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
[None, {'query': 'SELECT blah2', 'depth': 2, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
[None, {'query': 'SELECT blah3', 'depth': 0, 'as_list': True,
'with_lists': None, 'ignore_null': False}],
['1', {'query': 'SELECT blah1', 'depth': 0, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
['2', {'query': 'SELECT blah2', 'depth': 2, 'as_list': False,
'with_lists': None, 'ignore_null': False}],
['3', {'query': 'SELECT blah3', 'depth': 0, 'as_list': True,
'with_lists': None, 'ignore_null': False}]
], qbuffer)
示例6: test_112_process_results_legacy_multiple
def test_112_process_results_legacy_multiple(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b'], 0)
return_data.with_lists = []
return_data.process_results([[1, 2], [3, 4], [5, 6]])
self.assertEqual(
{1: 2, 3: 4, 5: 6},
return_data.result
)
示例7: test_111_process_results_legacy
def test_111_process_results_legacy(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b'], 0)
return_data.with_lists = []
return_data.process_results([[1, 2]])
self.assertEqual(
{1: 2},
return_data.result
)
示例8: test_131_process_results_overwrite_legacy_multiple
def test_131_process_results_overwrite_legacy_multiple(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b'], 0)
return_data.with_lists = []
return_data.process_results([[1, 2], [3, 4], [1, 6]])
self.assertEqual(
{1: 6, 3: 4},
return_data.result
)
示例9: test_122_process_results_depth_1
def test_122_process_results_depth_1(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b', 'c', 'd'], 1)
return_data.with_lists = []
return_data.enter_root(None)
return_data.process_results([[1, 2, 3, 4], [5, 6, 7, 8]])
self.assertEqual(
{1: {'b': 2, 'c': 3, 'd': 4}, 5: {'b': 6, 'c': 7, 'd': 8}},
return_data.result
)
示例10: test_125_process_results_depth_4
def test_125_process_results_depth_4(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b', 'c', 'd'], 4)
return_data.with_lists = []
return_data.enter_root(None)
return_data.process_results([[1, 2, 3, 4], [5, 6, 7, 8]])
self.assertEqual(
{1: {2: {3: 4}}, 5: {6: {7: 8}}},
return_data.result
)
示例11: test_134_process_results_deepmerge_depth_0
def test_134_process_results_deepmerge_depth_0(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b', 'c', 'd'], 0)
return_data.with_lists = []
return_data.enter_root(None)
return_data.process_results([[1, 2, 3, 4], [1, 2, 7, 8]])
self.assertEqual(
{1: {2: {3: 4, 7: 8}}},
return_data.result
)
示例12: test_137_process_results_overwrite_depth_2
def test_137_process_results_overwrite_depth_2(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b', 'c', 'd'], 2)
return_data.with_lists = []
return_data.enter_root(None)
return_data.process_results([[1, 2, 3, 4], [1, 2, 7, 8]])
self.assertEqual(
{1: {2: {'c': 7, 'd': 8}}},
return_data.result
)
示例13: test_201_process_results_complexity_multiresults
def test_201_process_results_complexity_multiresults(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b', 'c', 'd'], 2)
return_data.with_lists = []
return_data.enter_root(None)
return_data.process_results([[1, 2, 3, 4]])
return_data.process_results([[1, 2, 7, 8]])
self.assertEqual(
{1: {2: {'c': 7, 'd': 8}}},
return_data.result
)
示例14: test_203_process_results_complexity_as_list_deeper
def test_203_process_results_complexity_as_list_deeper(self):
return_data = mysql.merger()
return_data.process_fields(['a', 'b', 'c', 'd'], 0)
return_data.with_lists = []
return_data.enter_root(None)
return_data.as_list = True
return_data.process_results([[1, 2, 3, 4]])
return_data.process_results([[1, 2, 3, 8]])
self.assertEqual(
{1: {2: {3: [4, 8]}}},
return_data.result
)
示例15: test_006_extract_queries_bogus_kwargs
def test_006_extract_queries_bogus_kwargs(self):
# this test is cut down as most of the path matches test_*_bogus_list
return_data = mysql.merger()
args, kwargs = [], {
'1': 'SELECT blah',
'2': '',
'3': 'SELECT blah2'
}
qbuffer = return_data.extract_queries(args, kwargs)
self.assertEqual([
['1', {'query': 'SELECT blah', 'depth': 0, 'as_list': False, 'with_lists': None}],
['3', {'query': 'SELECT blah2', 'depth': 0, 'as_list': False, 'with_lists': None}]
], qbuffer)