def test_simple_type_objects(self): t1 = self.type_callable(self.fx.a, self.fx.a) t2 = self.type_callable(self.fx.b, self.fx.b) self.assert_join(t1, t1, t1) assert_true(join_types(t1, t1, self.fx.basic).is_type_obj()) self.assert_join(t1, t2, self.fx.std_type) self.assert_join(t1, self.fx.std_type, self.fx.std_type) self.assert_join(self.fx.std_type, self.fx.std_type, self.fx.std_type)
def assert_simple_meet(self, s, t, meet): result = meet_types(s, t, self.fx.basic) actual = str(result) expected = str(meet) assert_equal(actual, expected, 'meet({}, {}) == {{}} ({{}} expected)'.format(s, t)) if not isinstance(s, ErrorType) and not isinstance(result, ErrorType): assert_true(is_subtype(result, s), '{} not subtype of {}'.format(result, s)) if not isinstance(t, ErrorType) and not isinstance(result, ErrorType): assert_true(is_subtype(result, t), '{} not subtype of {}'.format(result, t))
def assert_simple_join(self, s, t, join): result = join_types(s, t, self.fx.basic) actual = str(result) expected = str(join) assert_equal(actual, expected, 'join({}, {}) == {{}} ({{}} expected)'.format(s, t)) if not isinstance(s, ErrorType) and not isinstance(result, ErrorType): assert_true(is_subtype(s, result), '{} not subtype of {}'.format(s, result)) if not isinstance(t, ErrorType) and not isinstance(result, ErrorType): assert_true(is_subtype(t, result), '{} not subtype of {}'.format(t, result))
def assert_not_subtype(self, s, t): assert_true(not is_subtype(s, t), '{} subtype of {}'.format(s, t))
def assert_subtype(self, s, t): assert_true(is_subtype(s, t), '{} not subtype of {}'.format(s, t))