Пример #1
0
    def test_parse_requirement(self):
        """Test parse requirements of a function to dictionary."""
        myRequirement = requirements_collect(F4)[0]
        parsed_req = parse_single_requirement(myRequirement)
        expected_req = {'category': 'hazard',
                        'subcategory': ['flood', 'tsunami']}
        myMessage = 'Get %s should be % s' % (parsed_req, expected_req)
        assert parsed_req == expected_req, myMessage

        myRequirement = requirements_collect(F4)[1]
        parsed_req = parse_single_requirement(myRequirement)
        expected_req = {'category': 'exposure',
                        'subcategory': ['building', 'structure'],
                        'layertype': 'vector'}
        myMessage = 'Get %s should be % s' % (parsed_req, expected_req)
        assert parsed_req == expected_req, myMessage
Пример #2
0
    def test_parse_requirement(self):
        """Test parse requirements of a function to dictionary."""
        myRequirement = requirements_collect(F4)[0]
        parsed_req = parse_single_requirement(myRequirement)
        expected_req = {'category': 'hazard',
                        'subcategory': ['flood', 'tsunami']}
        myMessage = 'Get %s should be % s' % (parsed_req, expected_req)
        assert parsed_req == expected_req, myMessage

        myRequirement = requirements_collect(F4)[1]
        parsed_req = parse_single_requirement(myRequirement)
        expected_req = {'category': 'exposure',
                        'subcategory': ['building', 'structure'],
                        'layertype': 'vector'}
        myMessage = 'Get %s should be % s' % (parsed_req, expected_req)
        assert parsed_req == expected_req, myMessage
Пример #3
0
 def test_basic_plugin_requirements_met(self):
     """Basic plugin requirements met
     """
     requirelines = requirements_collect(BasicFunctionCore)
     valid_return = ['category=="test_cat1"', 'unit=="MMI"']
     for ret1, ret2 in zip(valid_return, requirelines):
         assert ret1 == ret2, "Error in requirements extraction"
Пример #4
0
    def test_get_plugins(self):
        """Plugins can be collected."""
        os.environ['LANG'] = 'en'
        plugin_list = get_plugins()
        assert(len(plugin_list) > 0)

        # Obtain string representation
        string_rep = admissible_plugins_to_str(plugin_list)

        # Check each plugin
        for plugin in plugin_list.values():
            # Check that it's name appeears in string representation
            title = get_function_title(plugin)
            msg = ('Expected title %s in string representation: %s'
                   % (title, string_rep))
            assert title in string_rep, msg

            # Check that every plugin has a requires line
            requirements = requirements_collect(plugin)
            msg = 'There were no requirements in plugin %s' % plugin
            assert(len(requirements) > 0), msg

            for req_str in requirements:
                msg = 'All plugins should return True or False'
                assert(requirement_check({'category': 'hazard',
                                          'subcategory': 'earthquake',
                                          'layerType': 'raster'},
                                         req_str) in [True, False]), msg
Пример #5
0
 def test_basic_plugin_requirements_met(self):
     """Basic plugin requirements met
     """
     requirelines = requirements_collect(BasicFunctionCore)
     valid_return = ['category=="test_cat1"', 'unit=="MMI"']
     for ret1, ret2 in zip(valid_return, requirelines):
         assert ret1 == ret2, "Error in requirements extraction"
Пример #6
0
    def test_get_plugins(self):
        """Plugins can be collected."""
        os.environ['LANG'] = 'en'
        plugin_list = get_plugins()
        self.assertGreater(len(plugin_list), 0)

        # Obtain string representation
        string_rep = admissible_plugins_to_str(plugin_list)

        # Check each plugin
        for plugin in plugin_list.values():
            # Check that it's name appears in string representation
            title = get_function_title(plugin)
            message = ('Expected title %s in string representation: %s' %
                       (title, string_rep))
            assert title in string_rep, message

            # Check that every plugin has a requires line
            requirements = requirements_collect(plugin)
            message = 'There were no requirements in plugin %s' % plugin
            assert (len(requirements) > 0), message

            for required_string in requirements:
                message = 'All plugins should return True or False'
                assert (requirement_check(
                    {
                        'category': 'hazard',
                        'subcategory': 'earthquake',
                        'layerType': 'raster'
                    }, required_string) in [True, False]), message
Пример #7
0
    def test_plugin_selection(self):
        """Verify the plugins can recognize compatible layers.
        """
        exposure =[
                 'topp:buildings_osm_4326',
                 {'layertype': 'vector',
                  'category': 'exposure',
                  'subcategory': 'structure',
                  'title': 'buildings_osm_4326',
                  'datatype': 'osm',
                  'purpose': 'dki'
                 }
               ]
        hazard = [
                 'topp:jakarta_flood_like_2007_with_structural_improvements',
                  {'layertype': 'raster',
                   'category': 'hazard',
                   'subcategory': 'flood',
                   'title': 'Jakarta flood like 2007 with structural improvements',
                   'resolution': '0.00045228819716',
                   'unit': 'm'
                   }
               ]
        layers = [exposure, hazard]

        exposure_name, exposure_params = exposure
        hazard_name, hazard_params = hazard

        requirements = requirements_collect(FloodBuildingImpactFunction)

        exposure_compatible = requirements_met(requirements, exposure_params)
        assert exposure_compatible

        hazard_compatible = requirements_met(requirements, hazard_params)
        assert hazard_compatible
Пример #8
0
    def test_basic_plugin_requirements_met(self):
        """Test requirements_met"""
        requirements = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat1', 'unit': 'MMI'}
        self.assertTrue(requirements_met(requirements, params))

        params = {'category': 'test_cat2', 'unit': 'mmi2'}
        self.assertFalse(requirements_met(requirements, params))
Пример #9
0
    def test_basic_plugin_requirements_met(self):
        """Test requirements_met"""
        requirements = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat1', 'unit': 'MMI'}
        self.assertTrue(requirements_met(requirements, params))

        params = {'category': 'test_cat2', 'unit': 'mmi2'}
        self.assertFalse(requirements_met(requirements, params))
Пример #10
0
    def test_basic_plugin_requirements(self):
        """Basic plugin requirements collection
        """
        requirelines = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat1', 'unit': 'MMI'}
        assert requirements_met(requirelines, params)

        params = {'category': 'test_cat2', 'unit': 'mmi2'}
        assert not requirements_met(requirelines, params)
Пример #11
0
    def test_basic_plugin_requirements(self):
        """Basic plugin requirements collection
        """
        requirelines = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat1', 'unit': 'MMI'}
        assert requirements_met(requirelines, params)

        params = {'category': 'test_cat2', 'unit': 'mmi2'}
        assert not requirements_met(requirelines, params)
Пример #12
0
    def test_basic_plugin_requirements(self):
        """Basic plugin requirements collection
        """
        requirelines = requirements_collect(BasicFunction)
        params = {'category': 'hazard', 'unit': 'mmi'}
        assert requirements_met(requirelines, params)

        params = {'category': 'exposure', 'unit': 'mmi2'}
        assert requirements_met(requirelines, params, True) == False
Пример #13
0
    def test_basic_requirements_check(self):
        """Test requirement_check."""
        requirements = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat2'}
        for line in requirements:
            check = requirement_check(params, line)
            self.assertFalse(check)

        line = "unit='MMI'"
        params = {'category': 'test_cat2'}
        msg = 'Malformed statement (logged)'
        self.assertFalse(requirement_check(params, line), msg)
Пример #14
0
    def test_basic_requirements_check(self):
        """Test requirement_check."""
        requirements = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat2'}
        for line in requirements:
            check = requirement_check(params, line)
            self.assertFalse(check)

        line = "unit='MMI'"
        params = {'category': 'test_cat2'}
        msg = 'Malformed statement (logged)'
        self.assertFalse(requirement_check(params, line), msg)
Пример #15
0
    def test_basic_requirements_check(self):
        """Basic plugin requirements check
        """
        requirelines = requirements_collect(BasicFunction)
        params = {'category': 'exposure'}
        for line in requirelines:
            check = requirement_check(params, line)
            assert check == False

        line = "unit='mmi'"
        params = {'category': 'exposure'}
        msg = 'Malformed statement (logged)'
        assert requirement_check(params, line) == False, msg
Пример #16
0
    def test_basic_requirements_check(self):
        """Basic plugin requirements check
        """
        requirelines = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat2'}
        for line in requirelines:
            check = requirement_check(params, line)
            assert not check

        line = "unit='MMI'"
        params = {'category': 'test_cat2'}
        msg = 'Malformed statement (logged)'
        assert not requirement_check(params, line), msg
Пример #17
0
    def test_basic_requirements_check(self):
        """Basic plugin requirements check
        """
        requirelines = requirements_collect(BasicFunctionCore)
        params = {'category': 'test_cat2'}
        for line in requirelines:
            check = requirement_check(params, line)
            assert not check

        line = "unit='MMI'"
        params = {'category': 'test_cat2'}
        msg = 'Malformed statement (logged)'
        assert not requirement_check(params, line), msg
Пример #18
0
    def test_requirements_check(self):
        """Plugins are correctly filtered based on requirements."""
        plugin_list = get_plugins('BasicFunction')
        self.assertEqual(len(plugin_list), 1)

        requirements = requirements_collect(plugin_list[0].values()[0])
        message = 'Requirements are %s' % requirements
        assert(len(requirements) == 1), message
        for req_str in requirements:
            message = 'Should eval to True'
            assert(requirement_check({'category': 'hazard'},
                                     req_str) is True), message
            message = 'Should eval to False'
            assert(requirement_check({'broke': 'broke'},
                                     req_str) is False), message

        try:
            plugin_list = get_plugins('NotRegistered')
        except RuntimeError:
            pass
        else:
            message = 'Search should fail'
            raise Exception(message)
Пример #19
0
    def test_requirements_check(self):
        """Plugins are correctly filtered based on requirements."""
        plugin_list = get_plugins('BasicFunction')
        self.assertEqual(len(plugin_list), 1)

        requirements = requirements_collect(plugin_list[0].values()[0])
        message = 'Requirements are %s' % requirements
        assert (len(requirements) == 1), message
        for req_str in requirements:
            message = 'Should eval to True'
            assert (requirement_check({'category': 'hazard'}, req_str) is
                    True), message
            message = 'Should eval to False'
            assert (requirement_check({'broke': 'broke'}, req_str) is
                    False), message

        try:
            plugin_list = get_plugins('NotRegistered')
        except RuntimeError:
            pass
        else:
            message = 'Search should fail'
            raise Exception(message)
Пример #20
0
    def test_plugin_selection(self):
        """Verify the plugins can recognize compatible layers.
        """
        exposure = [
            'topp:buildings_osm_4326', {
                'layertype': 'vector',
                'category': 'exposure',
                'subcategory': 'structure',
                'title': 'buildings_osm_4326',
                'datatype': 'osm',
                'purpose': 'dki'
            }
        ]
        hazard = [
            'topp:jakarta_flood_like_2007_with_structural_improvements', {
                'layertype': 'raster',
                'category': 'hazard',
                'subcategory': 'flood',
                'title':
                'Jakarta flood like 2007 with structural improvements',
                'resolution': '0.00045228819716',
                'unit': 'm'
            }
        ]
        layers = [exposure, hazard]

        exposure_name, exposure_params = exposure
        hazard_name, hazard_params = hazard

        requirements = requirements_collect(FloodBuildingImpactFunction)

        exposure_compatible = requirements_met(requirements, exposure_params)
        assert exposure_compatible

        hazard_compatible = requirements_met(requirements, hazard_params)
        assert hazard_compatible
Пример #21
0
 def test_basic_plugin_requirements(self):
     """Test requirements_collect."""
     requirements = requirements_collect(BasicFunctionCore)
     valid_return = ['category=="test_cat1"', 'unit=="MMI"']
     for ret1, ret2 in zip(valid_return, requirements):
         self.assertEqual(ret1, ret2, "Error in requirements extraction")
Пример #22
0
 def test_basic_plugin_requirements(self):
     """Test requirements_collect."""
     requirements = requirements_collect(BasicFunctionCore)
     valid_return = ['category=="test_cat1"', 'unit=="MMI"']
     for ret1, ret2 in zip(valid_return, requirements):
         self.assertEqual(ret1, ret2, "Error in requirements extraction")
Пример #23
0
    def test_filtering_of_impact_functions(self):
        """Impact functions are filtered correctly
        """

        # Check empty call returns all
        P = get_admissible_plugins([])

        # List the known impact function names
        # based on their class names - not their titles
        msg = 'Available impact functions are: %s' % str(P.keys())
        #print msg
        assert 'Flood Evacuation Function Vector Hazard' in P, msg
        assert 'I T B Earthquake Building Damage Function' in P, msg
        assert 'Earthquake Building Impact Function' in P, msg
        assert 'P A G Fatality Function' in P, msg
        assert 'Flood Evacuation Function' in P, msg
        assert 'Flood Building Impact Function' in P, msg
        assert 'I T B Fatality Function' in P, msg
        assert 'Volcano Building Impact' in P, msg
        assert 'Volcano Polygon Hazard Population' in P, msg

        # This one should get 2 earthquake building impact functions
        D1 = {'category': 'hazard', 'subcategory': 'earthquake', 'unit': 'MMI'}
        D2 = {
            'category': 'exposure',
            'datatype': 'itb',
            'subcategory': 'structure'
        }

        # Add layertype
        D1['layertype'] = 'raster'
        D2['layertype'] = 'vector'
        P = get_admissible_plugins([D1, D2])
        msg = 'Expected: len(P) >= 2, Got: len(P) is %i' % len(P)
        assert len(P) >= 1, msg  # Depending on other tests there could be more
        assert 'Earthquake Building Impact Function' in P

        # This one should get 3 flood population impact functions
        D1 = {'category': 'hazard', 'subcategory': 'flood', 'unit': 'm'}
        D2 = {'category': 'exposure', 'subcategory': 'population'}

        # Add layertype
        D1['layertype'] = 'raster'
        D2['layertype'] = 'raster'
        P = get_admissible_plugins([D1, D2])
        assert len(P) >= 1  # Depending on other tests there could be more
        #assert 'W B Flood Evacuation Function' in P

        # Try form where only one dictionary is passed
        # This one gets all the flood related impact functions

        # Try to get general inundation building impact function
        f_name = 'Flood Building Impact Function'

        P = get_admissible_plugins(D1)
        assert len(P) >= 2
        #assert 'W B Flood Evacuation Function' in P
        assert f_name in P
        #assert 'Flood Road Impact Function' in P

        D1 = {'category': 'hazard', 'subcategory': 'tsunami'}
        D2 = {'category': 'exposure', 'subcategory': 'structure'}

        # Add layertype
        #D1['layertype'] = 'raster'  # Not required for flood building impact
        D2['layertype'] = 'vector'
        P = get_admissible_plugins([D1, D2])

        msg = 'Expected name "%s" in P: %s' % (f_name, P)
        assert f_name in P, msg

        # Get requirements from expected function
        P_all = get_admissible_plugins()
        assert P[f_name] == P_all[f_name]

        requirelines = requirements_collect(P[f_name])
        for i, D in enumerate([D1, D2]):
            for key in D:
                msg = 'Key %s was not found in %s' % (key, requirelines[i])
                assert key in requirelines[i], msg

                msg = 'Val %s was not found in %s' % (D[key], requirelines[i])
                assert D[key] in requirelines[i], msg
    def test_filtering_of_impact_functions(self):
        """Impact functions are filtered correctly
        """

        # Check empty call returns all
        admissible_plugins = get_admissible_plugins([])

        # List the known impact function names
        # based on their class names - not their titles
        message = (
            'Available impact functions are: %s' %
            str(admissible_plugins.keys()))

        if_names = [
            'Flood Evacuation Function Vector Hazard',
            'Earthquake Building Impact Function',
            'PAG Fatality Function',
            'Flood Evacuation Function',
            'Flood Vector Building Impact Function',
            'Flood Raster Building Impact Function',
            'ITB Fatality Function',
            'Volcano Building Impact',
            'Volcano Polygon Hazard Population',
            ]

        for if_name in if_names:
            self.assertIn(if_name, admissible_plugins, message)

        # This one should get 1 earthquake building impact functions
        dict1 = dict(
            category='hazard',
            subcategory='earthquake',
            layertype='raster',
            unit='MMI')

        dict2 = dict(
            category='exposure',
            subcategory='structure',
            layertype='vector',
            datatype='itb')

        admissible_plugins = get_admissible_plugins([dict1, dict2])
        message = (
            'Expected: len(admissible_plugins) >= 1, Got: '
            'len(admissible_plugins) is %i' % len(admissible_plugins))
        # Depending on other tests there could be more
        self.assertTrue(len(admissible_plugins) >= 1, message)
        self.assertIn(
            'Earthquake Building Impact Function', admissible_plugins)

        # This one should get 1 flood population impact functions
        dict1 = dict(
            category='hazard',
            subcategory='flood',
            layertype='raster',
            unit='m')
        dict2 = dict(
            category='exposure',
            subcategory='population',
            layertype='raster')

        admissible_plugins = get_admissible_plugins([dict1, dict2])
        # Depending on other tests there could be more
        self.assertTrue(len(admissible_plugins) >= 1)
        # Try to get general inundation population impact function
        f_name = 'Flood Evacuation Function'
        self.assertIn(f_name, admissible_plugins)

        admissible_plugins = get_admissible_plugins(dict1)
        self.assertTrue(len(admissible_plugins) >= 1)
        self.assertIn(f_name, admissible_plugins)

        dict1 = dict(
            category='hazard',
            subcategory='flood',
            layertype='raster')
        dict2 = dict(
            category='exposure',
            subcategory='structure',
            layertype='vector')

        admissible_plugins = get_admissible_plugins([dict1, dict2])
        f_name = 'Flood Raster Building Impact Function'
        message = 'Expected name "%s" in admissible_plugins: %s' % (
            f_name, admissible_plugins)
        self.assertIn(f_name, admissible_plugins, message)

        # Get requirements from expected function
        all_plugins = get_admissible_plugins()
        self.assertEqual(admissible_plugins[f_name], all_plugins[f_name])

        requirelines = requirements_collect(admissible_plugins[f_name])
        for i, D in enumerate([dict1, dict2]):
            for key in D:
                message = 'Key %s was not found in %s' % (key, requirelines[i])
                self.assertIn(key, requirelines[i], message)

                message = (
                    'Val %s was not found in %s' % (D[key], requirelines[i]))
                self.assertIn(D[key], requirelines[i], message)
    def test_filtering_of_impact_functions(self):
        """Impact functions are filtered correctly
        """

        # Check empty call returns all
        P = get_admissible_plugins([])

        # List the known impact function names
        # based on their class names - not their titles
        msg = 'Available impact functions are: %s' % str(P.keys())
        #print msg
        assert 'Flood Evacuation Function Vector Hazard' in P, msg
        assert 'I T B Earthquake Building Damage Function' in P, msg
        assert 'Earthquake Building Impact Function' in P, msg
        assert 'P A G Fatality Function' in P, msg
        assert 'Flood Evacuation Function' in P, msg
        assert 'Flood Building Impact Function' in P, msg
        assert 'I T B Fatality Function' in P, msg
        assert 'Volcano Building Impact' in P, msg
        assert 'Volcano Polygon Hazard Population' in P, msg

        # This one should get 2 earthquake building impact functions
        D1 = {'category': 'hazard', 'subcategory': 'earthquake', 'unit': 'MMI'}
        D2 = {'category': 'exposure', 'datatype': 'itb',
              'subcategory': 'structure'}

        # Add layertype
        D1['layertype'] = 'raster'
        D2['layertype'] = 'vector'
        P = get_admissible_plugins([D1, D2])
        msg = 'Expected: len(P) >= 2, Got: len(P) is %i' % len(P)
        assert len(P) >= 1, msg  # Depending on other tests there could be more
        assert 'Earthquake Building Impact Function' in P

        # This one should get 3 flood population impact functions
        D1 = {'category': 'hazard', 'subcategory': 'flood', 'unit': 'm'}
        D2 = {'category': 'exposure', 'subcategory': 'population'}

        # Add layertype
        D1['layertype'] = 'raster'
        D2['layertype'] = 'raster'
        P = get_admissible_plugins([D1, D2])
        assert len(P) >= 1  # Depending on other tests there could be more
        #assert 'W B Flood Evacuation Function' in P

        # Try form where only one dictionary is passed
        # This one gets all the flood related impact functions

        # Try to get general inundation building impact function
        f_name = 'Flood Building Impact Function'

        P = get_admissible_plugins(D1)
        assert len(P) >= 2
        #assert 'W B Flood Evacuation Function' in P
        assert f_name in P
        #assert 'Flood Road Impact Function' in P

        D1 = {'category': 'hazard', 'subcategory': 'tsunami'}
        D2 = {'category': 'exposure', 'subcategory': 'structure'}

        # Add layertype
        #D1['layertype'] = 'raster'  # Not required for flood building impact
        D2['layertype'] = 'vector'
        P = get_admissible_plugins([D1, D2])

        msg = 'Expected name "%s" in P: %s' % (f_name, P)
        assert f_name in P, msg

        # Get requirements from expected function
        P_all = get_admissible_plugins()
        assert P[f_name] == P_all[f_name]

        requirelines = requirements_collect(P[f_name])
        for i, D in enumerate([D1, D2]):
            for key in D:
                msg = 'Key %s was not found in %s' % (key, requirelines[i])
                assert key in requirelines[i], msg

                msg = 'Val %s was not found in %s' % (D[key], requirelines[i])
                assert D[key] in requirelines[i], msg
Пример #26
0
    def test_filtering_of_impact_functions(self):
        """Impact functions are filtered correctly
        """

        # Check empty call returns all
        admissible_plugins = get_admissible_plugins([])

        # List the known impact function names
        # based on their class names - not their titles
        msg = (
            'Available impact functions are: %s' %
            str(admissible_plugins.keys()))

        self.assertIn(
            'Flood Evacuation Function Vector Hazard',
            admissible_plugins, msg)
        self.assertIn(
            'I T B Earthquake Building Damage Function',
            admissible_plugins, msg)
        self.assertIn(
            'Earthquake Building Impact Function',
            admissible_plugins, msg)
        self.assertIn(
            'P A G Fatality Function',
            admissible_plugins, msg)
        self.assertIn(
            'Flood Evacuation Function',
            admissible_plugins, msg)
        self.assertIn(
            'Flood Building Impact Function',
            admissible_plugins, msg)
        self.assertIn(
            'I T B Fatality Function',
            admissible_plugins, msg)
        self.assertIn(
            'Volcano Building Impact',
            admissible_plugins, msg)
        self.assertIn(
            'Volcano Polygon Hazard Population',
            admissible_plugins, msg)

        # This one should get 2 earthquake building impact functions
        dict1 = {
            'category': 'hazard',
            'subcategory': 'earthquake',
            'unit': 'MMI'}
        dict2 = dict(
            category='exposure',
            datatype='itb',
            subcategory='structure')

        # Add layertype
        dict1['layertype'] = 'raster'
        dict2['layertype'] = 'vector'
        admissible_plugins = get_admissible_plugins([dict1, dict2])
        msg = (
            'Expected: len(admissible_plugins) >= 2, Got: '
            'len(admissible_plugins) is %i' % len(admissible_plugins))
        # Depending on other tests there could be more
        assert len(admissible_plugins) >= 1, msg
        assert 'Earthquake Building Impact Function' in admissible_plugins

        # This one should get 3 flood population impact functions
        dict1 = {'category': 'hazard', 'subcategory': 'flood', 'unit': 'm'}
        dict2 = dict(category='exposure', subcategory='population')

        # Add layertype
        dict1['layertype'] = 'raster'
        dict2['layertype'] = 'raster'
        admissible_plugins = get_admissible_plugins([dict1, dict2])
        # Depending on other tests there could be more
        assert len(admissible_plugins) >= 1
        # assert 'W B Flood Evacuation Function' in admissible_plugins

        # Try form where only one dictionary is passed
        # This one gets all the flood related impact functions

        # Try to get general inundation building impact function
        f_name = 'Flood Building Impact Function'

        admissible_plugins = get_admissible_plugins(dict1)
        assert len(admissible_plugins) >= 2
        # assert 'W B Flood Evacuation Function' in admissible_plugins
        assert f_name in admissible_plugins
        # assert 'Flood Road Impact Function' in admissible_plugins

        dict1 = {'category': 'hazard', 'subcategory': 'tsunami'}
        dict2 = dict(category='exposure', subcategory='structure')

        # Add layertype
        # Not required for flood building impact
        # dict1['layertype'] = 'raster'
        dict2['layertype'] = 'vector'
        admissible_plugins = get_admissible_plugins([dict1, dict2])

        msg = 'Expected name "%s" in admissible_plugins: %s' % (
            f_name, admissible_plugins)
        assert f_name in admissible_plugins, msg

        # Get requirements from expected function
        all_plugins = get_admissible_plugins()
        assert admissible_plugins[f_name] == all_plugins[f_name]

        requirelines = requirements_collect(admissible_plugins[f_name])
        for i, D in enumerate([dict1, dict2]):
            for key in D:
                msg = 'Key %s was not found in %s' % (key, requirelines[i])
                assert key in requirelines[i], msg

                msg = 'Val %s was not found in %s' % (D[key], requirelines[i])
                assert D[key] in requirelines[i], msg