(self)
| 51 | assert self.get(d, ":z") == 3 |
| 52 | |
| 53 | def test_badkey(self): |
| 54 | d = {":x": 1, ":y": (inc, ":x"), ":z": (add, ":x", ":y")} |
| 55 | try: |
| 56 | result = self.get(d, "badkey") |
| 57 | except KeyError: |
| 58 | pass |
| 59 | else: |
| 60 | msg = "Expected `{}` with badkey to raise KeyError.\n" |
| 61 | msg += f"Obtained '{result}' instead." |
| 62 | assert False, msg.format(self.get.__name__) |
| 63 | |
| 64 | def test_nested_badkey(self): |
| 65 | d = {"x": 1, "y": 2, "z": (sum, ["x", "y"])} |