예제 #1
0
 def test_and_clause_push_down_supermodel(self):
     results = normalize_query([{
         '_model':
         'Human',
         'or': [{
             'field': 'nickname',
             'value': 'Johnny'
         }, {
             'field': 'nickname',
             'value': 'Winny'
         }]
     }, {
         '_model': 'Proxy'
     }])
     assert results == [{
         '_model':
         'Human',
         'or': [{
             '_model': 'Human',
             'field': 'nickname',
             'value': 'Johnny'
         }, {
             '_model': 'Human',
             'field': 'nickname',
             'value': 'Winny'
         }]
     }, {
         '_model': 'Proxy'
     }]
예제 #2
0
 def test_or_clause(self):
     results = normalize_query([{
         '_model':
         'Human',
         'or': [{
             '_model': 'Human',
             'field': 'nickname',
             'value': 'Johnny'
         }, {
             '_model': 'Human',
             'field': 'nickname',
             'value': 'Winny'
         }]
     }, {
         '_model': 'Proxy'
     }])
     assert results == [{
         '_model':
         'Human',
         'or': [{
             '_model': 'Human',
             'field': 'nickname',
             'value': 'Johnny'
         }, {
             '_model': 'Human',
             'field': 'nickname',
             'value': 'Winny'
         }]
     }, {
         '_model': 'Proxy'
     }]
예제 #3
0
 def test_and_clause_no_model(self):
     results = normalize_query([{
         'and': [{
             '_model': 'Human'
         }, {
             '_model': 'Human',
             'field': 'nickname',
             'value': 'Johnny'
         }]
     }, {
         '_model': 'Proxy'
     }])
     assert results == [{
         '_model':
         'Human',
         'and': [{
             '_model': 'Human'
         }, {
             '_model': 'Human',
             'field': 'nickname',
             'value': 'Johnny'
         }]
     }, {
         '_model': 'Proxy'
     }]
예제 #4
0
 def test_two_strings(self):
     results = normalize_query(['Human', 'Proxy'])
     assert results == [{
         '_model': 'Human',
         '_label': 'Human'
     }, {
         '_model': 'Proxy',
         '_label': 'Proxy'
     }]
     results = normalize_query(['Proxy', 'Human'])
     assert results == [{
         '_model': 'Proxy',
         '_label': 'Proxy'
     }, {
         '_model': 'Human',
         '_label': 'Human'
     }]
예제 #5
0
 def test_one_dict_in_a_list(self):
     results = normalize_query([{'_model':'Human'}])
     assert results == [{'_model':'Human'}]
예제 #6
0
 def test_one_dict(self):
     results = normalize_query({'_model':'Human'})
     assert results == [{'_model':'Human'}]
예제 #7
0
 def test_two_strings(self):
     results = normalize_query(['Human', 'Proxy'])
     assert results == [{'_model':'Human', '_label':'Human'}, {'_model':'Proxy', '_label':'Proxy'}]
     results = normalize_query(['Proxy', 'Human'])
     assert results == [{'_model':'Proxy', '_label':'Proxy'}, {'_model':'Human', '_label':'Human'}]
예제 #8
0
 def test_one_string_in_a_list(self):
     results = normalize_query(['Human'])
     assert results == [{'_model':'Human', '_label':'Human'}]
예제 #9
0
 def test_one_string(self):
     results = normalize_query('Human')
     assert results == [{'_model':'Human', '_label':'Human'}]
예제 #10
0
 def test_and_clause_push_down_supermodel(self):
     results = normalize_query([{'_model':'Human', 'or':[{'field':'nickname', 'value':'Johnny'}, {'field':'nickname', 'value':'Winny'}]}, {'_model':'Proxy'}])
     assert results == [{'_model':'Human', 'or':[{'_model':'Human', 'field':'nickname', 'value':'Johnny'}, {'_model':'Human', 'field':'nickname', 'value':'Winny'}]}, {'_model':'Proxy'}]
예제 #11
0
파일: test_sa.py 프로젝트: ftobia/sideboard
 def test_one_dict_in_a_list(self):
     results = normalize_query([{'_model':'Human'}])
     self.assertEquals(results, [{'_model':'Human'}])
예제 #12
0
파일: test_sa.py 프로젝트: ftobia/sideboard
 def test_two_strings(self):
     results = normalize_query(['Human', 'Proxy'])
     self.assertEquals(results, [{'_model':'Human', '_label':'Human'}, {'_model':'Proxy', '_label':'Proxy'}])
     results = normalize_query(['Proxy', 'Human'])
     self.assertEquals(results, [{'_model':'Proxy', '_label':'Proxy'}, {'_model':'Human', '_label':'Human'}])
예제 #13
0
파일: test_sa.py 프로젝트: ftobia/sideboard
 def test_one_string_in_a_list(self):
     results = normalize_query(['Human'])
     self.assertEquals(results, [{'_model':'Human', '_label':'Human'}])
예제 #14
0
파일: test_sa.py 프로젝트: ftobia/sideboard
 def test_one_string(self):
     results = normalize_query('Human')
     self.assertEquals(results, [{'_model':'Human', '_label':'Human'}])
예제 #15
0
 def test_two_dicts(self):
     results = normalize_query([{'_model':'Human'}, {'_model':'Proxy'}])
     assert results == [{'_model':'Human'}, {'_model':'Proxy'}]
     results = normalize_query([{'_model':'Proxy'}, {'_model':'Human'}])
     assert results == [{'_model':'Proxy'}, {'_model':'Human'}]
예제 #16
0
 def test_or_clause(self):
     results = normalize_query([{'_model':'Human', 'or':[{'_model':'Human', 'field':'nickname', 'value':'Johnny'}, {'_model':'Human', 'field':'nickname', 'value':'Winny'}]}, {'_model':'Proxy'}])
     assert results == [{'_model':'Human', 'or':[{'_model':'Human', 'field':'nickname', 'value':'Johnny'}, {'_model':'Human', 'field':'nickname', 'value':'Winny'}]}, {'_model':'Proxy'}]
예제 #17
0
파일: test_sa.py 프로젝트: ftobia/sideboard
 def test_two_dicts(self):
     results = normalize_query([{'_model':'Human'}, {'_model':'Proxy'}])
     self.assertEquals(results, [{'_model':'Human'}, {'_model':'Proxy'}])
     results = normalize_query([{'_model':'Proxy'}, {'_model':'Human'}])
     self.assertEquals(results, [{'_model':'Proxy'}, {'_model':'Human'}])
예제 #18
0
 def test_and_clause_no_model(self):
     results = normalize_query([{'and':[{'_model':'Human'}, {'_model':'Human', 'field':'nickname', 'value':'Johnny'}]}, {'_model':'Proxy'}])
     assert results == [{'_model':'Human', 'and':[{'_model':'Human'}, {'_model':'Human', 'field':'nickname', 'value':'Johnny'}]}, {'_model':'Proxy'}]
예제 #19
0
파일: test_sa.py 프로젝트: ftobia/sideboard
 def test_and_clause(self):
     results = normalize_query([{'_model':'Human', 'and':[{'_model':'Human', 'field':'nickname', 'value':'Johnny'}, {'_model':'Human', 'field':'nickname', 'value':'Winny'}]}, {'_model':'Proxy'}])
     self.assertEquals(results, [{'_model':'Human', 'and':[{'_model':'Human', 'field':'nickname', 'value':'Johnny'}, {'_model':'Human', 'field':'nickname', 'value':'Winny'}]}, {'_model':'Proxy'}])