def test_load_dictionary(self): d = du.load_dictionary('SUN908_inoutdoor_dictionary') self.assertTrue(d['/a/art_studio']['indoor']) # test for categories that are not marked as indoor or outdoor self.assertFalse(any(d['/a/archaelogical_excavation'].values())) # test for categories that are marked as both indoor and outdoor self.assertFalse(in_xor_out_door(d['/t/ticket_booth'])) # test for categories that are marked as both outdoor natural and outdoor man-made self.assertFalse(natural_xor_man_made(d['/a/aqueduct']))
def get_pure_doorness_categories(d): # returns the filtered dictionary containing only the categories that are indoor or outdoor but not both filtered_d = {k: v for (k, v) in d.items() if in_xor_out_door(d[k])} return filtered_d