Exemplo n.º 1
0
def test_max2_tuple():
    assert parser({'max_items': 2}, (1, 2), 3) == [(1, 2), (3, None)]
Exemplo n.º 2
0
def test_min2_tuple():
    assert parser({'min_items': 2, 'max_items': 2}, (1, 2)) == [(1, 2)]
Exemplo n.º 3
0
def test_max2_args3():
    assert parser({'max_items': 2}, 1, 2, 3) == [(1, None), (2, None), (3, None)]
Exemplo n.º 4
0
def test_empty_dictionary_exception():
    with pytest.raises(sqlpuzzle.exceptions.SqlPuzzleException):
        parser({}, {'key': 1})
Exemplo n.º 5
0
def test_min2_args2():
    assert parser({'min_items': 2, 'max_items': 2}, 1, 2) == [(1, 2)]
Exemplo n.º 6
0
def test_dict_too_few_exception():
    with pytest.raises(AssertionError):
        parser({'allow_dict': True}, 'arg')
Exemplo n.º 7
0
def test_empty_tuple():
    assert parser({}, (1,)) == [(1,)]
 def test_max2_tuple(self):
     self.assertEqual(parser({'max_items': 2}, (1, 2), 3), [(1, 2),
                                                            (3, None)])
Exemplo n.º 9
0
 def test_max2_args1(self):
     self.assertEqual(parser({'max_items': 2}, 1), [(1, None)])
Exemplo n.º 10
0
 def test_max2_args3(self):
     self.assertEqual(parser({'max_items': 2}, 1, 2, 3), [(1, None),
                                                          (2, None),
                                                          (3, None)])
Exemplo n.º 11
0
 def test_max2_list(self):
     self.assertEqual(parser({'max_items': 2}, [1, 2], 3), [(1, 2),
                                                            (3, None)])
Exemplo n.º 12
0
 def test_max2_args1(self):
     self.assertEqual(parser({'max_items': 2}, 1), [(1, None)])
Exemplo n.º 13
0
 def test_min2_tuple(self):
     self.assertEqual(parser({
         'min_items': 2,
         'max_items': 2
     }, (1, 2)), [(1, 2)])
Exemplo n.º 14
0
 def test_min2_ist(self):
     self.assertEqual(parser({
         'min_items': 2,
         'max_items': 2
     }, [1, 2]), [(1, 2)])
Exemplo n.º 15
0
def test_empty_args1():
    assert parser({}, 1) == [(1,)]
Exemplo n.º 16
0
 def test_max2_args3(self):
     self.assertEqual(parser({'max_items': 2}, 1, 2, 3), [(1, None), (2, None), (3, None)])
Exemplo n.º 17
0
def test_dict_args():
    assert parser({'allow_dict': True, 'max_items': 2}, {'key': 1}) == [('key', 1)]
Exemplo n.º 18
0
 def test_max2_list(self):
     self.assertEqual(parser({'max_items': 2}, [1, 2], 3), [(1, 2), (3, None)])
Exemplo n.º 19
0
 def test_min2_args2(self):
     self.assertEqual(parser({
         'min_items': 2,
         'max_items': 2
     }, 1, 2), [(1, 2)])
Exemplo n.º 20
0
 def test_max2_tuple(self):
     self.assertEqual(parser({'max_items': 2}, (1, 2), 3), [(1, 2), (3, None)])
Exemplo n.º 21
0
def test_empty_kwds_exception():
    with pytest.raises(sqlpuzzle.exceptions.SqlPuzzleException):
        parser({}, arg=1)
Exemplo n.º 22
0
 def test_args(self):
     self.assertEqual(parser({'allow_dict': True, 'max_items': 2}, {'key': 1}), [('key', 1)])
Exemplo n.º 23
0
def test_empty_too_many_exception():
    with pytest.raises(sqlpuzzle.exceptions.SqlPuzzleException):
        parser({}, (1, 2))
Exemplo n.º 24
0
 def test_kwds(self):
     self.assertEqual(parser({'allow_dict': True, 'max_items': 2}, key=1), [('key', 1)])
Exemplo n.º 25
0
def test_min2_list():
    assert parser({'min_items': 2, 'max_items': 2}, [1, 2]) == [(1, 2)]
Exemplo n.º 26
0
 def test_list(self):
     self.assertEqual(parser({'allow_list': True}, (1, 2, 3)), [(1,), (2,), (3,)])
Exemplo n.º 27
0
def test_max2_args1():
    assert parser({'max_items': 2}, 1) == [(1, None)]
Exemplo n.º 28
0
 def test(self):
     self.assertEqual(parser({'allow_dict': True, 'max_items': 2}, 'a', b=2), [('a', None), ('b', 2)])
Exemplo n.º 29
0
def test_max2_list():
    assert parser({'max_items': 2}, [1, 2], 3) == [(1, 2), (3, None)]
Exemplo n.º 30
0
def test_list_list():
    assert parser({'allow_list': True}, (1, 2, 3)) == [(1,), (2,), (3,)]
Exemplo n.º 31
0
def test_min_bigger_than_max_exception():
    with pytest.raises(AssertionError):
        parser({'min_items': 2, 'max_items': 1})
Exemplo n.º 32
0
def test_args_and_kwds():
    assert parser({'allow_dict': True, 'max_items': 2}, 'a', b=2) == [('a', None), ('b', 2)]
Exemplo n.º 33
0
def test_too_many_exception():
    with pytest.raises(sqlpuzzle.exceptions.InvalidArgumentException):
        parser({'min_items': 2, 'max_items': 2}, 'arg1', 'arg2', 'arg3')
Exemplo n.º 34
0
def test_empty_args2():
    assert parser({}, 1, 2) == [(1,), (2,)]
Exemplo n.º 35
0
def test_dict_kwds():
    assert parser({'allow_dict': True, 'max_items': 2}, key=1) == [('key', 1)]
Exemplo n.º 36
0
def test_empty_list():
    assert parser({}, [1]) == [(1,)]
Exemplo n.º 37
0
def test_list_args():
    assert parser({'allow_list': True}, 1, 2, 3) == [(1,), (2,), (3,)]
Exemplo n.º 38
0
 def test_tuple(self):
     self.assertEqual(parser({}, (1, )), [(1, )])