|
1 | 1 | from ravenpackapi import RPApi |
2 | 2 |
|
3 | | - |
4 | | -class TestEntityMapping(object): |
| 3 | +if __name__ == '__main__': |
| 4 | + entities = [{'ticker': 'AAPL', 'name': 'Apple Inc.'}, |
| 5 | + {'ticker': 'JPM'}, |
| 6 | + {'listing': 'XNYS:DVN'}] |
5 | 7 | api = RPApi() |
6 | 8 |
|
7 | | - def test_matching_entity_mapping(self): |
8 | | - entities = [{'ticker': 'AAPL', 'name': 'Apple Inc.'}, |
9 | | - {'ticker': 'JPM'}, |
10 | | - {'listing': 'XNYS:DVN'}] |
11 | | - api = self.api |
12 | | - mapping = api.get_entity_mapping(entities) |
13 | | - assert not mapping.errors |
14 | | - assert len(mapping.matched) == len(mapping.submitted) == 3 |
15 | | - |
16 | | - # let's get the first mapped entities |
17 | | - rp_entity_ids = [match.id for match in mapping.matched] |
18 | | - assert rp_entity_ids == ['D8442A', '619882', '14BA06'] |
| 9 | + mapping = api.get_entity_mapping(entities) |
19 | 10 |
|
20 | | - def test_mismatch_mapping(self): |
21 | | - entities = ["unknown!"] |
22 | | - api = self.api |
23 | | - mapping = api.get_entity_mapping(entities) |
24 | | - rp_entity_ids = [match.id for match in mapping.matched] |
25 | | - assert rp_entity_ids == [] |
| 11 | + # show the matched entities |
| 12 | + for match in mapping.matched: |
| 13 | + print(match.id, match.name, match.type, match.request) |
0 commit comments