def generate_categories_with_regions(self, driving_dataset): # Add categories cat1 = LandCoverRegionCategory() cat1.driving_dataset_id = driving_dataset.id cat1.name = "Rivers" cat1.id = 1 region1 = LandCoverRegion() region1.id = 1 region1.name = "Thames" region1.category_id = 1 region1.category = cat1 region2 = LandCoverRegion() region2.id = 2 region2.name = "Itchen" region2.category_id = 1 region2.category = cat1 cat1.regions = [region1, region2] cat2 = LandCoverRegionCategory() cat2.driving_dataset_id = driving_dataset.id cat2.name = "Counties" cat2.id = 2 region3 = LandCoverRegion() region3.id = 3 region3.name = "Hampshire" region3.category_id = 2 region3.category = cat2 region4 = LandCoverRegion() region4.id = 4 region4.name = "Oxfordshire" region4.category_id = 2 region4.category = cat2 cat2.regions = [region3, region4] return [cat1, cat2]
def _mock_get_land_cover_categories(driving_data_id): cat1 = LandCoverRegionCategory() cat1.driving_dataset_id = driving_data_id cat1.name = "Rivers" cat1.id = 1 region1 = LandCoverRegion() region1.id = 1 region1.name = "Thames" region1.category_id = 1 region1.category = cat1 region2 = LandCoverRegion() region2.id = 2 region2.name = "Itchen" region2.category_id = 1 region2.category = cat1 cat1.regions = [region1, region2] cat2 = LandCoverRegionCategory() cat2.driving_dataset_id = driving_data_id cat2.name = "Counties" cat2.id = 2 region3 = LandCoverRegion() region3.id = 3 region3.name = "Hampshire" region3.category_id = 2 region3.category = cat2 region4 = LandCoverRegion() region4.id = 4 region4.name = "Oxfordshire" region4.category_id = 2 region4.category = cat2 cat2.regions = [region3, region4] return [cat1, cat2]
def _mock_lcs_get_land_cover_region_wrong_dataset(id): dds = DrivingDataset() dds.id = 7 land_cover_type = LandCoverRegionCategory() land_cover_type.id = 1 land_cover_type.driving_dataset_id = 7 land_cover_type.driving_dataset = dds land_cover_region = LandCoverRegion() land_cover_region.id = id land_cover_region.name = "Sand" land_cover_region.category = land_cover_type return land_cover_region
def _mock_lcs_get_actions_for_model_run_wrong_dataset(model_run): cat = LandCoverRegionCategory() cat.id = 1 cat.name = "Countries" cat.driving_dataset_id = 2 region = LandCoverRegion() region.id = 1 region.name = "Wales" region.category = cat action = LandCoverAction() action.id = 1 action.region = region action.value_id = 1 return [action]