forked from tudo-seal/cls-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed subtyping bug, if supertype is an Intersection
- Loading branch information
1 parent
e8c8aa3
commit c7b2c8b
Showing
2 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import logging | ||
import unittest | ||
from bcls import Constructor | ||
from bcls.subtypes import Subtypes | ||
from bcls.types import Intersection | ||
|
||
|
||
class TestSubtype(unittest.TestCase): | ||
logger = logging.getLogger(__name__) | ||
logging.basicConfig( | ||
format="%(module)s %(levelname)s: %(message)s", | ||
# level=logging.INFO, | ||
) | ||
|
||
def test_constructor_refl(self) -> None: | ||
a = Constructor("A") | ||
subtypes = Subtypes({}) | ||
self.assertTrue(subtypes.check_subtype(a, a)) | ||
|
||
def test_idempotence_right(self) -> None: | ||
a = Constructor("A") | ||
|
||
subtypes = Subtypes({}) | ||
self.assertTrue(subtypes.check_subtype(a, Intersection(a, a))) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |