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