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


Python Spec.description方法代码示例

本文整理汇总了Python中lancelot.Spec.description方法的典型用法代码示例。如果您正苦于以下问题:Python Spec.description方法的具体用法?Python Spec.description怎么用?Python Spec.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lancelot.Spec的用法示例。


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

示例1: notcontain_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def notcontain_behaviour():
    ''' NotContain comparator should negate the behaviour of Contain '''
    spec = Spec(NotContain(1))
    spec.description().should_be('not contain 1')
    spec.compares_to([1, 2]).should_be(False)
    spec.compares_to([1]).should_be(False)
    spec.compares_to([2]).should_be(True)
开发者ID:gbremer,项目名称:lancelot,代码行数:9,代码来源:comparator_spec.py

示例2: greaterthanorequal_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def greaterthanorequal_behaviour():
    ''' GreaterThanOrEqual should compare using >= '''
    spec = Spec(GreaterThanOrEqual(2))
    spec.description().should_be("=> 2")
    spec.compares_to(2).should_be(True)
    spec.compares_to(1).should_be(False)
    spec.compares_to('a').should_be(False)
开发者ID:gbremer,项目名称:lancelot,代码行数:9,代码来源:comparator_spec.py

示例3: lessthanorequal_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def lessthanorequal_behaviour():
    ''' LessThanOrEqual should compare using <= '''
    spec = Spec(LessThanOrEqual(2))
    spec.description().should_be("<= 2")
    spec.compares_to(1).should_be(True)
    spec.compares_to(2).should_be(True)
    spec.compares_to(3).should_be(False)
    spec.compares_to('a').should_be(False)
开发者ID:gbremer,项目名称:lancelot,代码行数:10,代码来源:comparator_spec.py

示例4: nothing_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def nothing_behaviour():
    ''' Nothing comparator should never find compared objects equivalent. '''
    spec = Spec(Nothing())
    spec.description().should_be("nothing")
    spec.compares_to(1).should_be(False)
    spec.compares_to('1').should_be(False)
    spec.compares_to([1]).should_be(False)
    spec.compares_to('xyz').should_be(False)
开发者ID:gbremer,项目名称:lancelot,代码行数:10,代码来源:comparator_spec.py

示例5: anything_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def anything_behaviour():
    ''' Anything comparator should find all compared objects equivalent. '''
    spec = Spec(Anything())
    spec.description().should_be("anything")
    spec.compares_to(1).should_be(True)
    spec.compares_to('1').should_be(True)
    spec.compares_to([1]).should_be(True)
    spec.compares_to('xyz').should_be(True)
开发者ID:gbremer,项目名称:lancelot,代码行数:10,代码来源:comparator_spec.py

示例6: notnonevalue_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def notnonevalue_behaviour():
    ''' NotNoneValue comparator should compare objects with not-None '''
    spec = Spec(NotNoneValue())
    spec.description().should_be('not None')
    spec.compares_to(None).should_be(False)
    spec.compares_to(1).should_be(True)
    spec.compares_to(2).should_be(True)
    spec.compares_to([]).should_be(True)
    spec.compares_to('').should_be(True)
开发者ID:gbremer,项目名称:lancelot,代码行数:11,代码来源:comparator_spec.py

示例7: empty_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def empty_behaviour():
    ''' Empty comparator should compare len(object) to 0 '''
    spec = Spec(Empty())
    spec.description().should_be('empty')
    spec.compares_to([1, 2]).should_be(False)
    spec.compares_to([1]).should_be(False)
    spec.compares_to([]).should_be(True)
    spec.compares_to('z').should_be(False)
    spec.compares_to('').should_be(True)
开发者ID:gbremer,项目名称:lancelot,代码行数:11,代码来源:comparator_spec.py

示例8: length_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def length_behaviour():
    ''' Length comparator should compare len(object) to specified length '''
    spec = Spec(Length(1))
    spec.description().should_be('length 1')
    spec.compares_to([1, 2]).should_be(False)
    spec.compares_to([1]).should_be(True)
    spec.compares_to([2]).should_be(True)
    spec.compares_to('z').should_be(True)
    spec.compares_to('xyz').should_be(False)
开发者ID:gbremer,项目名称:lancelot,代码行数:11,代码来源:comparator_spec.py

示例9: sameas_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def sameas_behaviour():
    ''' SameAs comparator should compare objects with "same" / "is" '''
    spec = Spec(SameAs(1))
    spec.description().should_be('same as 1')
    spec.compares_to(1).should_be(True)
    spec.compares_to(2).should_be(False)
    
    spec = Spec(SameAs([]))
    spec.description().should_be('same as []')
    spec.compares_to([]).should_be(False) 
开发者ID:gbremer,项目名称:lancelot,代码行数:12,代码来源:comparator_spec.py

示例10: type_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def type_behaviour():
    ''' Type comparator should compare type() '''
    spec = Spec(Type(list))
    spec.compares_to([]).should_be(True)
    spec.compares_to({}).should_be(False)
    spec.description().should_be("type <class 'list'>")

    spec = Spec(Type([]))
    spec.compares_to([]).should_be(True)
    spec.compares_to({}).should_be(False)
    spec.description().should_be("type <class 'list'>")
开发者ID:gbremer,项目名称:lancelot,代码行数:13,代码来源:comparator_spec.py

示例11: equalsequals_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def equalsequals_behaviour():
    ''' EqualsEquals comparator should compare objects with == '''
    spec = Spec(EqualsEquals(1))
    spec.description().should_be('== 1')
    spec.compares_to(1).should_be(True)
    spec.compares_to(2).should_be(False)
    
    spec = Spec(EqualsEquals([]))
    spec.description().should_be('== []')
    spec.compares_to([]).should_be(True)
    spec.compares_to([1]).should_be(False)
开发者ID:gbremer,项目名称:lancelot,代码行数:13,代码来源:comparator_spec.py

示例12: greaterthan_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def greaterthan_behaviour():
    ''' GreaterThan comparator should compare objects with > '''
    spec = Spec(GreaterThan(1))
    spec.description().should_be('> 1')
    spec.compares_to(2).should_be(True)
    spec.compares_to(1).should_be(False)
    spec.compares_to('a').should_be(False)
    
    spec = Spec(GreaterThan([]))
    spec.description().should_be('> []')
    spec.compares_to([]).should_be(False)
    spec.compares_to([1]).should_be(True)
开发者ID:gbremer,项目名称:lancelot,代码行数:14,代码来源:comparator_spec.py

示例13: lessthan_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def lessthan_behaviour():
    ''' LessThan comparator should compare objects with < '''
    spec = Spec(LessThan(1))
    spec.description().should_be('< 1')
    spec.compares_to(0).should_be(True)
    spec.compares_to(1).should_be(False)
    spec.compares_to('a').should_be(False)
    
    spec = Spec(LessThan([1]))
    spec.description().should_be('< [1]')
    spec.compares_to([]).should_be(True)
    spec.compares_to([1]).should_be(False)
开发者ID:gbremer,项目名称:lancelot,代码行数:14,代码来源:comparator_spec.py

示例14: notcomparator_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def notcomparator_behaviour():
    ''' NotComparator should negate other comparisons '''
    spec = Spec(NotComparator(EqualsEquals(1)))
    spec.description().should_be('not == 1')
    spec.compares_to(1).should_be(False)
    spec.compares_to('1').should_be(True)
    spec.compares_to([1]).should_be(True)
    
    spec = Spec(NotComparator(EqualsEquals('1')))
    spec.description().should_be("not == '1'")
    spec.compares_to('1').should_be(False)
    spec.compares_to(1).should_be(True)
    spec.compares_to([1]).should_be(True)
开发者ID:gbremer,项目名称:lancelot,代码行数:15,代码来源:comparator_spec.py

示例15: strequals_behaviour

# 需要导入模块: from lancelot import Spec [as 别名]
# 或者: from lancelot.Spec import description [as 别名]
def strequals_behaviour():
    ''' StrEquals comparator should compare objects with str() '''
    spec = Spec(StrEquals(1))
    spec.description().should_be("str() value '1'")
    spec.compares_to(1).should_be(True)
    spec.compares_to('1').should_be(True)
    spec.compares_to([1]).should_be(False)
    
    spec = Spec(StrEquals('1'))
    spec.description().should_be("str() value '1'")
    spec.compares_to(1).should_be(True)
    spec.compares_to('1').should_be(True)
    spec.compares_to([1]).should_be(False)
开发者ID:gbremer,项目名称:lancelot,代码行数:15,代码来源:comparator_spec.py


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