def test_expand_pool_spec(self):

        schema = {'id': self.schema_attrs['id']}

        # wrong type
        self.assertRaises(NipapInputError, self.nipap._expand_pool_spec, 'string')
        # wrong type
        self.assertRaises(NipapInputError, self.nipap._expand_pool_spec, 1)
        # wrong type
        self.assertRaises(NipapInputError, self.nipap._expand_pool_spec, [])
        # missing keys
        self.assertRaises(NipapMissingInputError, self.nipap._expand_pool_spec, { })
        # crap key
        self.assertRaises(NipapExtraneousInputError, self.nipap._expand_pool_spec, { 'crap': self.pool_attrs['name'] })
        # required keys and extra crap
        self.assertRaises(NipapExtraneousInputError, self.nipap._expand_pool_spec, { 'id': self.pool_attrs['id'], 'schema': self.schema_attrs['id'], 'crap': 'crap' })
        # proper key but incorrect value (int vs string)
        self.assertRaises(NipapValueError, self.nipap._expand_pool_spec, { 'id': '3', 'schema': self.schema_attrs['id'] })
        # proper key but incorrect value (int vs string)
        self.assertRaises(NipapValueError, self.nipap._expand_pool_spec, { 'name': 3, 'schema': self.schema_attrs['id'] })
        # both id and name
        self.assertRaises(NipapExtraneousInputError, self.nipap._expand_pool_spec, { 'id': 3, 'name': '3', 'schema': self.schema_attrs['id'] })
        # proper key - id
        where, params = self.nipap._expand_pool_spec({ 'id': 3, 'schema': self.schema_attrs['id'] })
        self.assertEqual(where, 'po.id = %(spec_id)s AND po.schema = %(spec_schema)s', "Improperly expanded WHERE clause")
        self.assertEqual(params, {'spec_id': 3, 'spec_schema': self.schema_attrs['id']}, "Improperly expanded params dict")
        # proper spec - name
        where, params = self.nipap._expand_pool_spec({ 'name': 'test', 'schema': self.schema_attrs['id'] })
        self.assertEqual(where, 'po.name = %(spec_name)s AND po.schema = %(spec_schema)s', "Improperly expanded WHERE clause")
        self.assertEqual(params, {'spec_name': 'test', 'spec_schema': self.schema_attrs['id'] }, "Improperly expanded params dict")
Test the function which expands pool spec to SQL.
dataset/ETHPy150Open SpriteLink/NIPAP/tests/nipapbase.py/NipapTest.test_expand_pool_spec