Пример #1
0
    def test_multiple_correct_arguments(self):
        '''Test `validate_types` with multiple correct arguments'''

        client_utils.validate_types((
            ('name', protocol.STRING),
            ('age', protocol.Option(protocol.UINT32)),
        ), ('name', None, ))
Пример #2
0
    def test_multiple_correct_arguments(self):
        '''Test `validate_types` with multiple correct arguments'''

        client_utils.validate_types((
            ('name', protocol.STRING),
            ('age', protocol.Option(protocol.UINT32)),
        ), (
            'name',
            None,
        ))
Пример #3
0
    def test_single_incorrect_argument(self):
        '''Test `validate_types` if one incorrect argument is provided'''

        run_test = lambda value: client_utils.validate_types(
            (('i', protocol.UINT32), ), (value, ))

        self.assertRaises(ValueError, run_test, -1)
        self.assertRaises(TypeError, run_test, '1')
Пример #4
0
    def test_single_incorrect_argument(self):
        '''Test `validate_types` if one incorrect argument is provided'''

        run_test = lambda value: client_utils.validate_types(
            (('i', protocol.UINT32), ), (value, ))

        self.assertRaises(ValueError, run_test, -1)
        self.assertRaises(TypeError, run_test, '1')
Пример #5
0
    def test_multiple_incorrect_arguments(self):
        '''Test `validate_types` with multiple incorrect arguments'''

        run_test = lambda value: client_utils.validate_types((
            ('name', protocol.STRING),
            ('age', protocol.Option(protocol.UINT32)),
        ), ('name', value, ))

        self.assertRaises(ValueError, run_test, -1)
        self.assertRaises(TypeError, run_test, '1')
Пример #6
0
    def test_multiple_incorrect_arguments(self):
        '''Test `validate_types` with multiple incorrect arguments'''

        run_test = lambda value: client_utils.validate_types((
            ('name', protocol.STRING),
            ('age', protocol.Option(protocol.UINT32)),
        ), (
            'name',
            value,
        ))

        self.assertRaises(ValueError, run_test, -1)
        self.assertRaises(TypeError, run_test, '1')
Пример #7
0
    def test_single_correct_argument(self):
        '''Test `validate_types` if one correct argument is provided'''

        client_utils.validate_types((('name', protocol.STRING), ), ('name', ))
Пример #8
0
    def test_no_arguments(self):
        '''Test `validate_types` if no arguments are expected'''

        client_utils.validate_types((), ())
Пример #9
0
    def test_single_correct_argument(self):
        '''Test `validate_types` if one correct argument is provided'''

        client_utils.validate_types((('name', protocol.STRING), ), ('name', ))
Пример #10
0
    def test_no_arguments(self):
        '''Test `validate_types` if no arguments are expected'''

        client_utils.validate_types((), ())