当前位置: 首页>>代码示例>>Python>>正文


Python myunit.assert_true函数代码示例

本文整理汇总了Python中mypy.myunit.assert_true函数的典型用法代码示例。如果您正苦于以下问题:Python assert_true函数的具体用法?Python assert_true怎么用?Python assert_true使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了assert_true函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_mixed_truth_restricted_type

 def test_mixed_truth_restricted_type(self):
     # join_types against differently restricted truthiness types drops restrictions.
     true_any = true_only(AnyType())
     false_o = false_only(self.fx.o)
     j = join_types(true_any, false_o)
     assert_true(j.can_be_true)
     assert_true(j.can_be_false)
开发者ID:AXGKl,项目名称:Transcrypt,代码行数:7,代码来源:testtypes.py

示例2: test_mixed_truth_restricted_type_simple

 def test_mixed_truth_restricted_type_simple(self):
     # join_simple against differently restricted truthiness types drops restrictions.
     true_a = true_only(self.fx.a)
     false_o = false_only(self.fx.o)
     j = join_simple(self.fx.o, true_a, false_o)
     assert_true(j.can_be_true)
     assert_true(j.can_be_false)
开发者ID:AXGKl,项目名称:Transcrypt,代码行数:7,代码来源:testtypes.py

示例3: test_is_proper_subtype_invariance

    def test_is_proper_subtype_invariance(self):
        fx = self.fx

        assert_true(is_proper_subtype(fx.gsab, fx.gb))
        assert_false(is_proper_subtype(fx.gsab, fx.ga))
        assert_false(is_proper_subtype(fx.gsaa, fx.gb))
        assert_false(is_proper_subtype(fx.gb, fx.ga))
        assert_false(is_proper_subtype(fx.ga, fx.gb))
开发者ID:o11c,项目名称:mypy,代码行数:8,代码来源:testtypes.py

示例4: test_true_only_of_instance

 def test_true_only_of_instance(self):
     to = true_only(self.fx.a)
     assert_equal(str(to), "A")
     assert_true(to.can_be_true)
     assert_false(to.can_be_false)
     assert_type(Instance, to)
     # The original class still can be false
     assert_true(self.fx.a.can_be_false)
开发者ID:AXGKl,项目名称:Transcrypt,代码行数:8,代码来源:testtypes.py

示例5: test_false_only_of_instance

 def test_false_only_of_instance(self):
     fo = false_only(self.fx.a)
     assert_equal(str(fo), "A")
     assert_false(fo.can_be_true)
     assert_true(fo.can_be_false)
     assert_type(Instance, fo)
     # The original class still can be true
     assert_true(self.fx.a.can_be_true)
开发者ID:AXGKl,项目名称:Transcrypt,代码行数:8,代码来源:testtypes.py

示例6: test_true_only_of_union

 def test_true_only_of_union(self):
     tup_type = self.tuple(AnyType())
     # Union of something that is unknown, something that is always true, something
     # that is always false
     union_type = UnionType([self.fx.a, tup_type, self.tuple()])
     to = true_only(union_type)
     assert_equal(len(to.items), 2)
     assert_true(to.items[0].can_be_true)
     assert_false(to.items[0].can_be_false)
     assert_true(to.items[1] is tup_type)
开发者ID:AXGKl,项目名称:Transcrypt,代码行数:10,代码来源:testtypes.py

示例7: test_simple_type_objects

 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)
开发者ID:SRiikonen,项目名称:mypy,代码行数:10,代码来源:testtypes.py

示例8: test_false_only_of_union

 def test_false_only_of_union(self) -> None:
     tup_type = self.tuple()
     # Union of something that is unknown, something that is always true, something
     # that is always false
     union_type = UnionType([self.fx.a, self.tuple(AnyType()), tup_type])
     assert_equal(len(union_type.items), 3)
     fo = false_only(union_type)
     assert isinstance(fo, UnionType)
     assert_equal(len(fo.items), 2)
     assert_false(fo.items[0].can_be_true)
     assert_true(fo.items[0].can_be_false)
     assert_true(fo.items[1] is tup_type)
开发者ID:alexandrul,项目名称:mypy,代码行数:12,代码来源:testtypes.py

示例9: assert_simple_meet

 def assert_simple_meet(self, s, t, meet):
     result = meet_types(s, t)
     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))
开发者ID:o11c,项目名称:mypy,代码行数:12,代码来源:testtypes.py

示例10: assert_simple_join

 def assert_simple_join(self, s, t, join):
     result = join_types(s, t)
     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))
开发者ID:o11c,项目名称:mypy,代码行数:12,代码来源:testtypes.py

示例11: test_simple_type_objects

    def test_simple_type_objects(self) -> None:
        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)
        j = join_types(t1, t1)
        assert isinstance(j, CallableType)
        assert_true(j.is_type_obj())

        self.assert_join(t1, t2, self.fx.type_type)
        self.assert_join(t1, self.fx.type_type, self.fx.type_type)
        self.assert_join(self.fx.type_type, self.fx.type_type,
                         self.fx.type_type)
开发者ID:alexandrul,项目名称:mypy,代码行数:13,代码来源:testtypes.py

示例12: test_is_more_precise

    def test_is_more_precise(self):
        fx = self.fx
        assert_true(is_more_precise(fx.b, fx.a))
        assert_true(is_more_precise(fx.b, fx.b))
        assert_true(is_more_precise(fx.b, fx.b))
        assert_true(is_more_precise(fx.b, fx.anyt))
        assert_true(is_more_precise(self.tuple(fx.b, fx.a),
                                    self.tuple(fx.b, fx.a)))

        assert_false(is_more_precise(fx.a, fx.b))
        assert_false(is_more_precise(fx.anyt, fx.b))
        assert_false(is_more_precise(self.tuple(fx.b, fx.b),
                                     self.tuple(fx.b, fx.a)))
开发者ID:o11c,项目名称:mypy,代码行数:13,代码来源:testtypes.py

示例13: test_is_in_module_collection

 def test_is_in_module_collection(self):
     assert_true(moduleinfo.is_in_module_collection({'foo'}, 'foo'))
     assert_true(moduleinfo.is_in_module_collection({'foo'}, 'foo.bar'))
     assert_false(moduleinfo.is_in_module_collection({'foo'}, 'fo'))
     assert_true(moduleinfo.is_in_module_collection({'foo.bar'}, 'foo.bar'))
     assert_true(moduleinfo.is_in_module_collection({'foo.bar'}, 'foo.bar.zar'))
     assert_false(moduleinfo.is_in_module_collection({'foo.bar'}, 'foo'))
开发者ID:AXGKl,项目名称:Transcrypt,代码行数:7,代码来源:testmoduleinfo.py

示例14: test_is_proper_subtype_covariance

    def test_is_proper_subtype_covariance(self) -> None:
        fx_co = self.fx_co

        assert_true(is_proper_subtype(fx_co.gsab, fx_co.gb))
        assert_true(is_proper_subtype(fx_co.gsab, fx_co.ga))
        assert_false(is_proper_subtype(fx_co.gsaa, fx_co.gb))
        assert_true(is_proper_subtype(fx_co.gb, fx_co.ga))
        assert_false(is_proper_subtype(fx_co.ga, fx_co.gb))
开发者ID:alexandrul,项目名称:mypy,代码行数:8,代码来源:testtypes.py

示例15: test_is_proper_subtype_contravariance

    def test_is_proper_subtype_contravariance(self):
        fx_contra = self.fx_contra

        assert_true(is_proper_subtype(fx_contra.gsab, fx_contra.gb))
        assert_false(is_proper_subtype(fx_contra.gsab, fx_contra.ga))
        assert_true(is_proper_subtype(fx_contra.gsaa, fx_contra.gb))
        assert_false(is_proper_subtype(fx_contra.gb, fx_contra.ga))
        assert_true(is_proper_subtype(fx_contra.ga, fx_contra.gb))
开发者ID:o11c,项目名称:mypy,代码行数:8,代码来源:testtypes.py


注:本文中的mypy.myunit.assert_true函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。