def test_find_free_prefix_input(self):
        schema = {'id': self.schema_attrs['id']}
        # set up a prefix not used elsewhere so we have a known good state
        prefix_attrs = {
                'authoritative_source': 'nipap-test',
                'prefix': '100.0.0.0/16',
                'type': 'reservation',
                'description': 'test prefix',
                'comment': 'test comment, please remove! ;)'
                }
        self.nipap.add_prefix(self.auth, schema, prefix_attrs)

        # no schema, should raise error!
        self.assertRaises(NipapInputError, self.nipap.find_free_prefix, self.auth, schema, { 'from-prefix': ['100.0.0.0/16'] })

        # incorrect from-prefix type, string instead of list of strings (looking like an IP address)
        self.assertRaises(NipapInputError, self.nipap.find_free_prefix, self.auth, schema, { 'from-prefix': '100.0.0.0/16' })

        # missing prefix_length
        self.assertRaises(NipapMissingInputError, self.nipap.find_free_prefix, self.auth, schema, { 'from-prefix': [ '100.0.0.0/16' ], 'count': 1 })

        # try giving both IPv4 and IPv6 in from-prefix which shouldn't work
        self.assertRaises(NipapInputError, self.nipap.find_free_prefix, self.auth, schema, { 'from-prefix': [ '100.0.0.0/16', '2a00:800::0/25' ], 'prefix_length': 24, 'count': 1 })

        # try giving non-integer as wanted prefix length
        self.assertRaises(NipapValueError, self.nipap.find_free_prefix, self.auth, schema, { 'from-prefix': [ '100.0.0.0/16'], 'prefix_length': '24', 'count': 1 })

        # try giving to high a number as wanted prefix length for IPv4
        self.assertRaises(NipapValueError, self.nipap.find_free_prefix, self.auth, schema, { 'from-prefix': [ '100.0.0.0/16'], 'prefix_length': 35, 'count': 1 })

        # try giving to high a number as wanted prefix length for IPv6
        self.assertRaises(NipapValueError, self.nipap.find_free_prefix, self.auth, schema, { 'from-prefix': [ '2a00:800::1/25'], 'prefix_length': 150, 'count': 1 })

        # try giving a high number for result count (max is 1000)
        self.assertRaises(NipapValueError, self.nipap.find_free_prefix, self.auth, schema, { 'from-prefix': [ '100.0.0.0/16'], 'prefix_length': 30, 'count': 55555 })

        # don't pass 'family', which is required when specifying 'from-pool'
        self.assertRaises(NipapMissingInputError, self.nipap.find_free_prefix, self.auth, schema, { 'from-pool': { 'name': self.pool_attrs['name'] }, 'prefix_length': 24, 'count': 1 })

        # pass crap as family, wrong type even
        self.assertRaises(ValueError, self.nipap.find_free_prefix, self.auth, schema, { 'from-pool': { 'name': self.pool_attrs['name'] }, 'prefix_length': 24, 'count': 1, 'family': 'crap' })

        # pass 7 as family
        self.assertRaises(NipapValueError, self.nipap.find_free_prefix, self.auth, schema, { 'from-pool': { 'name': self.pool_attrs['name'] }, 'prefix_length': 24, 'count': 1, 'family': 7 })

        # pass non existent pool
        self.assertRaises(NipapNonExistentError, self.nipap.find_free_prefix, self.auth, schema, { 'from-pool': { 'name': 'crap' }, 'prefix_length': 24, 'count': 1, 'family': 4 })
Smooth the label
dataset/ETHPy150Open SpriteLink/NIPAP/tests/nipapbase.py/NipapTest.test_find_free_prefix_input--crossover with--dataset/ETHPy150Open mne-tools/mne-python/mne/label.py/Label.smooth