|
| 1 | +from hapi.pipelines.database.org import OrgInfo |
| 2 | + |
| 3 | + |
| 4 | +def check_org_mappings(pipelines): |
| 5 | + org_map = pipelines.org._org_map |
| 6 | + iom = OrgInfo( |
| 7 | + "International Organization for Migration", |
| 8 | + "international organization for migration", |
| 9 | + "IOM", |
| 10 | + "iom", |
| 11 | + "447", |
| 12 | + True, |
| 13 | + True, |
| 14 | + ) |
| 15 | + assert org_map[(None, "IOM")] == iom |
| 16 | + assert org_map[(None, "iom")] == iom |
| 17 | + assert ( |
| 18 | + org_map[ |
| 19 | + ( |
| 20 | + None, |
| 21 | + "Organisation Internationale pour les Migrations", |
| 22 | + ) |
| 23 | + ] |
| 24 | + == iom |
| 25 | + ) |
| 26 | + assert ( |
| 27 | + org_map[ |
| 28 | + ( |
| 29 | + None, |
| 30 | + "organisation internationale pour les migrations", |
| 31 | + ) |
| 32 | + ] |
| 33 | + == iom |
| 34 | + ) |
| 35 | + |
| 36 | + iom = OrgInfo( |
| 37 | + "International Organization for Migration", |
| 38 | + "international organization for migration", |
| 39 | + "IOM", |
| 40 | + "iom", |
| 41 | + "447", |
| 42 | + False, |
| 43 | + False, |
| 44 | + ) |
| 45 | + assert org_map[(None, "International Organisation for Migrations")] == iom |
| 46 | + assert org_map[(None, "international organisation for migrations")] == iom |
| 47 | + assert org_map[(None, "INTERNATIONALE ORGANISATION FOR MIGRATION")] == iom |
| 48 | + assert org_map[(None, "internationale organisation for migration")] == iom |
| 49 | + assert ( |
| 50 | + org_map[ |
| 51 | + ( |
| 52 | + None, |
| 53 | + "Organisation Internationale des Migrations", |
| 54 | + ) |
| 55 | + ] |
| 56 | + == iom |
| 57 | + ) |
| 58 | + assert ( |
| 59 | + org_map[ |
| 60 | + ( |
| 61 | + None, |
| 62 | + "organisation internationale des migrations", |
| 63 | + ) |
| 64 | + ] |
| 65 | + == iom |
| 66 | + ) |
| 67 | + assert ( |
| 68 | + org_map[ |
| 69 | + ( |
| 70 | + None, |
| 71 | + "OIM - International Organization for Migration", |
| 72 | + ) |
| 73 | + ] |
| 74 | + == iom |
| 75 | + ) |
| 76 | + assert ( |
| 77 | + org_map[ |
| 78 | + ( |
| 79 | + None, |
| 80 | + "oim international organization for migration", |
| 81 | + ) |
| 82 | + ] |
| 83 | + == iom |
| 84 | + ) |
| 85 | + |
| 86 | + unicef = OrgInfo( |
| 87 | + "United Nations Children's Fund", |
| 88 | + "united nations childrens fund", |
| 89 | + "UNICEF", |
| 90 | + "unicef", |
| 91 | + "447", |
| 92 | + True, |
| 93 | + True, |
| 94 | + ) |
| 95 | + assert org_map[(None, "United Nations Children's Fund")] == unicef |
| 96 | + assert org_map[(None, "united nations childrens fund")] == unicef |
| 97 | + assert org_map[(None, "UNICEF")] == unicef |
| 98 | + assert org_map[(None, "unicef")] == unicef |
| 99 | + assert org_map[(None, "Fonds des Nations Unies pour l'Enfance")] == unicef |
| 100 | + assert org_map[(None, "fonds des nations unies pour lenfance")] == unicef |
| 101 | + assert ( |
| 102 | + org_map[ |
| 103 | + ( |
| 104 | + None, |
| 105 | + "UNICEF - Fondo de las Naciones Unidas para la Infancia", |
| 106 | + ) |
| 107 | + ] |
| 108 | + == unicef |
| 109 | + ) |
| 110 | + assert ( |
| 111 | + org_map[ |
| 112 | + ( |
| 113 | + None, |
| 114 | + "unicef fondo de las naciones unidas para la infancia", |
| 115 | + ) |
| 116 | + ] |
| 117 | + == unicef |
| 118 | + ) |
| 119 | + |
| 120 | + unicef = OrgInfo( |
| 121 | + "United Nations Children's Fund", |
| 122 | + "united nations childrens fund", |
| 123 | + "UNICEF", |
| 124 | + "unicef", |
| 125 | + "447", |
| 126 | + False, |
| 127 | + False, |
| 128 | + ) |
| 129 | + assert ( |
| 130 | + org_map[(None, "United Nations Children's Emergency Fund")] == unicef |
| 131 | + ) |
| 132 | + assert org_map[(None, "united nations childrens emergency fund")] == unicef |
| 133 | + assert org_map[(None, "Fond des Nations Unies pour l'Enfance")] == unicef |
| 134 | + assert org_map[(None, "fond des nations unies pour lenfance")] == unicef |
| 135 | + assert ( |
| 136 | + org_map[ |
| 137 | + ( |
| 138 | + None, |
| 139 | + "United Nations International Childrens Emergency Fund", |
| 140 | + ) |
| 141 | + ] |
| 142 | + == unicef |
| 143 | + ) |
| 144 | + assert ( |
| 145 | + org_map[ |
| 146 | + ( |
| 147 | + None, |
| 148 | + "united nations international childrens emergency fund", |
| 149 | + ) |
| 150 | + ] |
| 151 | + == unicef |
| 152 | + ) |
| 153 | + |
| 154 | + assert org_map[("AFG", "WEWORLD")] == OrgInfo( |
| 155 | + "WEWORLD", |
| 156 | + "weworld", |
| 157 | + "WEWORLD", |
| 158 | + "weworld", |
| 159 | + None, |
| 160 | + True, |
| 161 | + False, |
| 162 | + ) |
| 163 | + |
| 164 | + assert org_map[("NGA", "HECADF")] == OrgInfo( |
| 165 | + "HECADF", |
| 166 | + "hecadf", |
| 167 | + "HECADF", |
| 168 | + "hecadf", |
| 169 | + "441", |
| 170 | + True, |
| 171 | + True, |
| 172 | + ) |
0 commit comments