()
| 831 | |
| 832 | |
| 833 | def test_map_duplicate_fields(): |
| 834 | ty = pa.map_(pa.string(), pa.int8()) |
| 835 | v = [('a', 1), ('a', 2)] |
| 836 | s = pa.scalar(v, type=ty) |
| 837 | |
| 838 | assert s.as_py(maps_as_pydicts=None) == v |
| 839 | |
| 840 | with pytest.raises(KeyError): |
| 841 | assert s.as_py(maps_as_pydicts="strict") |
| 842 | |
| 843 | with pytest.warns(match="Encountered key 'a' which was already encountered"): |
| 844 | assert s.as_py(maps_as_pydicts="lossy") == {'a': 2} |
| 845 | |
| 846 | |
| 847 | def test_dictionary(pickle_module): |