this repo has no description

Add more row poly tests

authored by bernsteinbear.com and committed by

Max Bernstein cc6e61af e7511ec3

+21
+21
scrapscript.py
··· 4501 4501 with self.assertRaisesRegex(InferenceError, "Unifying empty row with row {y=int, ...'t0}"): 4502 4502 unify_type(l, r) 4503 4503 4504 + def test_unify_one_open_one_closed(self) -> None: 4505 + rest = TyVar("r1") 4506 + l = TyRow({"x": IntType}) 4507 + r = TyRow({"x": IntType}, rest) 4508 + unify_type(l, r) 4509 + self.assertTyEqual(rest.find(), TyEmptyRow()) 4510 + 4511 + def test_unify_one_open_more_than_one_closed(self) -> None: 4512 + rest = TyVar("r1") 4513 + l = TyRow({"x": IntType}) 4514 + r = TyRow({"x": IntType, "y": StringType}, rest) 4515 + with self.assertRaisesRegex(InferenceError, "Unifying empty row with row {y=string, ...'r1}"): 4516 + unify_type(l, r) 4517 + 4518 + def test_unify_one_open_one_closed_more(self) -> None: 4519 + rest = TyVar("r1") 4520 + l = TyRow({"x": IntType, "y": StringType}) 4521 + r = TyRow({"x": IntType}, rest) 4522 + unify_type(l, r) 4523 + self.assertTyEqual(rest.find(), TyRow({"y": StringType})) 4524 + 4504 4525 def test_unify_left_missing_open(self) -> None: 4505 4526 l = TyRow({}, TyVar("r0")) 4506 4527 r = TyRow({"y": IntType}, TyVar("r1"))