(self)
| 66 | assert self.get(d, ":z") == 3 |
| 67 | |
| 68 | def test_badkey(self): |
| 69 | d = {":x": 1, ":y": (inc, ":x"), ":z": (add, ":x", ":y")} |
| 70 | try: |
| 71 | result = self.get(d, "badkey") |
| 72 | except KeyError: |
| 73 | pass |
| 74 | else: |
| 75 | msg = "Expected `{}` with badkey to raise KeyError.\n" |
| 76 | msg += f"Obtained '{result}' instead." |
| 77 | assert False, msg.format(self.get.__name__) |
| 78 | |
| 79 | def test_nested_badkey(self): |
| 80 | d = {"x": 1, "y": 2, "z": (sum, ["x", "y"])} |