• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sure.that函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_55_minutos_atras

def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_55_minutos_atras():
    u"TempoRelativo deveria descrever quando diferenca de tempo ocorreu ha 55 minutos atras"
    relative_time = datetime.now() - timedelta(minutes=55)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há 55 minutos")
    assert that(decorrido.atras).equals(u"55 minutos atrás")
    assert that(unicode(decorrido)).equals(u"há 55 minutos")
开发者ID:pombredanne,项目名称:vargas,代码行数:7,代码来源:tests.py


示例2: test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_1_mes_atras_com_31_dias

def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_1_mes_atras_com_31_dias():
    u"TempoRelativo deveria descrever quando diferenca de tempo ocorreu ha 1 mês atras"
    relative_time = datetime.now() - timedelta(minutes=60 * 24 * 31)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há 1 mês")
    assert that(decorrido.atras).equals(u"1 mês atrás")
    assert that(unicode(decorrido)).equals(u"há 1 mês")
开发者ID:pombredanne,项目名称:vargas,代码行数:7,代码来源:tests.py


示例3: select_by_attribute_id

def select_by_attribute_id(context):
    "selecting by attribute (id)"
    dom = DOM(context.html)

    (body, ) = dom.find("[id=firstp]")
    assert that(body).is_a(Element)
    assert that(body.attribute['id']).equals("firstp")
开发者ID:eroh92,项目名称:dominic,代码行数:7,代码来源:test_selectors.py


示例4: see_the_right_stop_and_duration_time

def see_the_right_stop_and_duration_time(step):
    stop_cell = world.wait_for_element('#stop-%s' % world.rows, 5, 0.5)
    assert that(stop_cell.text).equals(datetime.datetime.now().strftime("%B%e, %Y,%l:%M %P")), \
        'The stop time is not current'
    duration_cell = world.wait_for_element('#duration-%s' % world.rows, 5, 0.5)
    assert that(duration_cell.text).equals("00:00:03"), \
        'The duration is incorrect'
开发者ID:GunioRobot,项目名称:agile-django,代码行数:7,代码来源:details_steps.py


示例5: test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_menos_de_1_minuto_atras

def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_menos_de_1_minuto_atras():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha menos de 1 minuto atras"
    relative_time = datetime.now() - timedelta(seconds=55)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há menos de um minuto")
    assert that(decorrido.atras).equals(u"alguns segundos atrás")
    assert that(unicode(decorrido)).equals(u"há menos de um minuto")
开发者ID:wpjunior,项目名称:vargas,代码行数:7,代码来源:tests.py


示例6: test_that_something_iterable_matches_another

def test_that_something_iterable_matches_another():
    "sure.that(something_iterable).matches(another_iterable)"

    KlassOne = type('KlassOne', (object,), {})
    KlassTwo = type('KlassTwo', (object,), {})
    one = [
        ("/1", KlassOne),
        ("/2", KlassTwo),
    ]

    two = [
        ("/1", KlassOne),
        ("/2", KlassTwo),
    ]

    assert that(one).matches(two)
    assert that(one).equals(two)

    def fail_1():
        assert that(range(1)).matches(xrange(2))

    class Fail2(object):
        def __init__(self):
            assert that(xrange(1)).matches(range(2))

    class Fail3(object):
        def __call__(self):
            assert that(xrange(1)).matches(range(2))

    assert that(fail_1).raises('X is a list and Y is a xrange instead')
    assert that(Fail2).raises('X is a xrange and Y is a list instead')
    assert that(Fail3()).raises('X is a xrange and Y is a list instead')
开发者ID:e0ne,项目名称:sure,代码行数:32,代码来源:test_old_api.py


示例7: test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_1_hora_atras

def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_1_hora_atras():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha 1 hora atras"
    relative_time = datetime.now() - timedelta(minutes=60)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há 1 hora")
    assert that(decorrido.atras).equals(u"1 hora atrás")
    assert that(unicode(decorrido)).equals(u"há 1 hora")
开发者ID:wpjunior,项目名称:vargas,代码行数:7,代码来源:tests.py


示例8: test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_4_dias_atras

def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_4_dias_atras():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha 4 dias atras"
    relative_time = datetime.now() - timedelta(minutes=(60 * 24) * 4)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há 4 dias")
    assert that(decorrido.atras).equals(u"4 dias atrás")
    assert that(unicode(decorrido)).equals(u"há 4 dias")
开发者ID:wpjunior,项目名称:vargas,代码行数:7,代码来源:tests.py


示例9: select_by_id

def select_by_id(context):
    "selecting by id"
    dom = DOM(context.html)

    body = dom.find("#firstp").first()
    assert that(body).is_a(Element)
    assert that(body.attribute['id']).equals("firstp")
开发者ID:eroh92,项目名称:dominic,代码行数:7,代码来源:test_selectors.py


示例10: test_that_something_iterable_matches_another

def test_that_something_iterable_matches_another():
    "sure.that(something_iterable).matches(another_iterable)"

    KlassOne = type('KlassOne', (object,), {})
    KlassTwo = type('KlassTwo', (object,), {})
    one = [
        ("/1", KlassOne),
        ("/2", KlassTwo),
    ]

    two = [
        ("/1", KlassOne),
        ("/2", KlassTwo),
    ]

    assert that(one).matches(two)
    assert that(one).equals(two)

    def fail_1():
        assert that(range(1)).matches(xrange(2))

    class Fail2(object):
        def __init__(self):
            assert that(xrange(1)).equals(range(2))

    class Fail3(object):
        def __call__(self):
            assert that(xrange(1)).equals(range(2))

    assert that(fail_1).raises('[0] has 1 item, but xrange(2) has 2 items')
    assert that(Fail2).raises('xrange(1) has 1 item, but [0, 1] has 2 items')
    assert that(Fail3()).raises('xrange(1) has 1 item, but [0, 1] has 2 items')
开发者ID:pjdelport,项目名称:sure,代码行数:32,代码来源:test_sure.py


示例11: test_second_authentication_step_takes_code_and_makes_a_request

def test_second_authentication_step_takes_code_and_makes_a_request(context):
    "github.API's second authentication step is a redirect"

    class MyStore(github.TokenStore):
        data = {}

        def set(self, k, v):
            self.data[k] = v

        def get(self, k):
            return self.data.get(k)

    simple = MyStore()
    api = github.API("app-id-here", "app-secret-here", store=simple)

    HTTPretty.register_uri(
        HTTPretty.POST,
        "https://github.com/login/oauth/access_token",
        body='{"access_token": "this-is-the-access-token"}',
        status=200,
    )

    result = api.authenticate(code="visitor-code")
    assert that(result).is_a(github.API)

    last_request = HTTPretty.last_request
    assert that(last_request.headers).has("Authentication")
开发者ID:gabrielfalcao,项目名称:github-py,代码行数:27,代码来源:test_usage.py


示例12: test_have_property_with_value

def test_have_property_with_value():
    (u"this(instance).should.have.property(property_name).being or "
     ".with_value should allow chain up")

    class Person(object):
        name = "John Doe"

        def __repr__(self):
            return ur"Person()"

    jay = Person()

    assert this(jay).should.have.property("name").being.equal("John Doe")
    assert this(jay).should.have.property("name").not_being.equal("Foo")

    def opposite():
        assert this(jay).should.have.property("name").not_being.equal(
            "John Doe")

    def opposite_not():
        assert this(jay).should.have.property("name").being.equal(
            "Foo")

    assert that(opposite).raises(AssertionError)
    assert that(opposite).raises(
        "'John Doe' should differ to 'John Doe', but is the same thing")

    assert that(opposite_not).raises(AssertionError)
    assert that(opposite_not).raises(
        "X is 'John Doe' whereas Y is 'Foo'")
开发者ID:vrutkovs,项目名称:sure,代码行数:30,代码来源:test_assertion_builder.py


示例13: test_assertion_builder_synonyms

def test_assertion_builder_synonyms():
    (u"this, it, these and those are all synonyms")

    assert that(it).is_a(AssertionBuilder)
    assert that(this).is_a(AssertionBuilder)
    assert that(these).is_a(AssertionBuilder)
    assert that(those).is_a(AssertionBuilder)
开发者ID:vrutkovs,项目名称:sure,代码行数:7,代码来源:test_assertion_builder.py


示例14: test_have_property

def test_have_property():
    (u"this(instance).should.have.property(property_name)")

    class Person(object):
        name = "John Doe"

        def __repr__(self):
            return ur"Person()"

    jay = Person()

    assert this(jay).should.have.property("name")
    assert this(jay).should_not.have.property("age")

    def opposite():
        assert this(jay).should_not.have.property("name")

    def opposite_not():
        assert this(jay).should.have.property("age")

    assert that(opposite).raises(AssertionError)
    assert that(opposite).raises(
        "Person() should not have the property `name`, but it is 'John Doe'")

    assert that(opposite_not).raises(AssertionError)
    assert that(opposite_not).raises(
        "Person() should have the property `age` but doesn't")
开发者ID:vrutkovs,项目名称:sure,代码行数:27,代码来源:test_assertion_builder.py


示例15: select_html

def select_html(context):
    "selecting html"
    dom = DOM(context.html)

    html = dom.get("html")
    assert that(html).is_a(Element)
    assert that(html.attribute['id']).equals("html")
开发者ID:eroh92,项目名称:dominic,代码行数:7,代码来源:test_selectors.py


示例16: test_soundex_boundary

 def test_soundex_boundary(self):
     """
     Test case to ensure that the boundary cases of the soundex algorithm are handled appropriately.
     """
     assert that(self.runner.soundex('')).equals('0000')
     assert that(self.runner.soundex('   \r\n')).equals('0000')
     assert that(self.runner.soundex('3940')).equals('0000')
开发者ID:nyxtom,项目名称:fbpuzzles,代码行数:7,代码来源:test_breathalyzer.py


示例17: test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_1_minuto_e_meio_atras

def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_1_minuto_e_meio_atras():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha 1 minuto e meio atras"
    relative_time = datetime.now() - timedelta(seconds=90)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há pouco mais de 1 minuto")
    assert that(decorrido.atras).equals(u"1 minuto e 30 segundos atrás")
    assert that(unicode(decorrido)).equals(u"há pouco mais de 1 minuto")
开发者ID:wpjunior,项目名称:vargas,代码行数:7,代码来源:tests.py


示例18: test_httpretty_bypasses_when_disabled

def test_httpretty_bypasses_when_disabled():
    u"HTTPretty should bypass all requests by disabling it"

    HTTPretty.register_uri(HTTPretty.GET, "http://localhost:9999/go-for-bubbles/",
                           body="glub glub")

    HTTPretty.disable()

    fd = urllib2.urlopen('http://localhost:9999/go-for-bubbles/')
    got1 = fd.read()
    fd.close()

    assert that(got1).equals('. o O 0 O o . o O 0 O o . o O 0 O o . o O 0 O o . o O 0 O o .')

    fd = urllib2.urlopen('http://localhost:9999/come-again/')
    got2 = fd.read()
    fd.close()

    assert that(got2).equals('<- HELLO WORLD ->')

    HTTPretty.enable()

    fd = urllib2.urlopen('http://localhost:9999/go-for-bubbles/')
    got3 = fd.read()
    fd.close()

    assert that(got3).equals('glub glub')
开发者ID:nsigustavo,项目名称:HTTPretty,代码行数:27,代码来源:test_bypass.py


示例19: test_that_len_is

def test_that_len_is():
    "sure.that() len_is(number)"

    lst = range(1000)

    assert that(lst).len_is(1000)
    assert len(lst) == 1000
    assert that(lst).len_is(lst)
开发者ID:pjdelport,项目名称:sure,代码行数:8,代码来源:test_sure.py


示例20: attr_retrieves_each_attribute_by_name

def attr_retrieves_each_attribute_by_name(context):
    "attr retrieves attributes each attribute by name"
    dom = DOM(context.html)

    ul = dom.find("#objects").first()

    assert that(ul.attr('id')).equals('objects')
    assert that(ul.attr('class')).equals('list no-bullets')
开发者ID:gabrielfalcao,项目名称:dominic,代码行数:8,代码来源:test_manipulation.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sure.this函数代码示例发布时间:2022-05-27
下一篇:
Python sure.expect函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap