| 89 | assert is_runtime_subtype(r5, r) is False |
| 90 | |
| 91 | def test_eq_and_hash(self) -> None: |
| 92 | r = RStruct("Foo", ["a", "b"], [bool_rprimitive, int_rprimitive]) |
| 93 | |
| 94 | # using the exact same fields |
| 95 | r1 = RStruct("Foo", ["a", "b"], [bool_rprimitive, int_rprimitive]) |
| 96 | assert hash(r) == hash(r1) |
| 97 | assert r == r1 |
| 98 | |
| 99 | # different name |
| 100 | r2 = RStruct("Foq", ["a", "b"], [bool_rprimitive, int_rprimitive]) |
| 101 | assert hash(r) != hash(r2) |
| 102 | assert r != r2 |
| 103 | |
| 104 | # different names |
| 105 | r3 = RStruct("Foo", ["a", "c"], [bool_rprimitive, int_rprimitive]) |
| 106 | assert hash(r) != hash(r3) |
| 107 | assert r != r3 |
| 108 | |
| 109 | # different type |
| 110 | r4 = RStruct("Foo", ["a", "b"], [bool_rprimitive, int_rprimitive, bool_rprimitive]) |
| 111 | assert hash(r) != hash(r4) |
| 112 | assert r != r4 |