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

Python sure.this函数代码示例

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

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



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

示例1: test_receive_addresses

    def test_receive_addresses(self):

        HTTPretty.register_uri(HTTPretty.GET, "https://coinbase.com/api/v1/account/receive_address",
                               body='''{"address" : "1DX9ECEF3FbGUtzzoQhDT8CG3nLUEA2FJt"}''',
                               content_type='text/json')

        this(self.account.receive_address).should.equal(u'1DX9ECEF3FbGUtzzoQhDT8CG3nLUEA2FJt')
开发者ID:Mondego,项目名称:pyreco,代码行数:7,代码来源:allPythonContent.py


示例2: go

 def go(self, account):
     rates = account.exchange_rates
     this(last_request_params()).should.equal({})
     this(rates['gbp_to_usd']).should.be.equal(Decimal('1.648093'))
     this(rates['usd_to_btc']).should.be.equal(Decimal('0.002'))
     this(rates['btc_to_usd']).should.be.equal(Decimal('499.998'))
     this(rates['bdt_to_btc']).should.be.equal(Decimal('0.000026'))
开发者ID:LawnmowerIO,项目名称:coinbase_python,代码行数:7,代码来源:test_exchange_rate.py


示例3: test_sell_price_10

    def test_sell_price_10(self):
        HTTPretty.register_uri(HTTPretty.GET, "https://coinbase.com/api/v1/prices/sell?qty=1",
                               body='''{"amount":"630.31","currency":"USD"}''',
                               content_type='text/json')

        sell_price_10 = self.account.sell_price(10)
        this(sell_price_10).should.be.greater_than(100)
开发者ID:Mondego,项目名称:pyreco,代码行数:7,代码来源:allPythonContent.py


示例4: 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 r"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")

    expect(opposite).when.called.to.throw(AssertionError)
    expect(opposite).when.called.to.throw(compat_repr(
        "Person() should not have the property `name`, but it is 'John Doe'"))

    expect(opposite_not).when.called.to.throw(AssertionError)
    expect(opposite_not).when.called.to.throw(
        "Person() should have the property `age` but does not")
开发者ID:amukiza,项目名称:sure,代码行数:27,代码来源:test_assertion_builder.py


示例5: test_api_key_balance

    def test_api_key_balance(self):

        HTTPretty.register_uri(HTTPretty.GET, "https://coinbase.com/api/v1/account/balance",
                           body='''{"amount":"1.00000000","currency":"BTC"}''',
                           content_type='text/json')

        this(self.account.balance).should.equal(1.0)
开发者ID:Mondego,项目名称:pyreco,代码行数:7,代码来源:allPythonContent.py


示例6: test_be

def test_be():
    ("this(X).should.be(X) when X is a reference to the same object")

    d1 = {}
    d2 = d1
    d3 = {}

    assert isinstance(this(d2).should.be(d1), bool)
    assert this(d2).should.be(d1)
    assert this(d3).should_not.be(d1)

    def wrong_should():
        return this(d3).should.be(d1)

    def wrong_should_not():
        return this(d2).should_not.be(d1)

    wrong_should_not.when.called.should.throw(
        AssertionError,
        '{} should not be the same object as {}, but it is',
    )
    wrong_should.when.called.should.throw(
        AssertionError,
        '{} should be the same object as {}, but it is not',
    )
开发者ID:abg,项目名称:sure,代码行数:25,代码来源:test_assertion_builder.py


示例7: test_transactions

 def test_transactions(self):
     self.account.send(amount=CoinbaseAmount('.5', 'BTC'),
                       to_address='[email protected]')
     self.account.send(amount=CoinbaseAmount('.8', 'BTC'),
                       to_address='[email protected]')
     this([tx.recipient_address for tx in self.account.transactions()]) \
         .should.equal(['[email protected]', '[email protected]'])
开发者ID:LawnmowerIO,项目名称:coinbase_python,代码行数:7,代码来源:test_mocking.py


示例8: test_match_contain

def test_match_contain():
    (u"expect('some string').to.contain('tri')")

    assert this("some string").should.contain("tri")
    assert this("some string").should_not.contain('foo')

    def opposite():
        assert this("some string").should.contain("bar")

    def opposite_not():
        assert this("some string").should_not.contain(r"string")

    expect(opposite).when.called.to.throw(AssertionError)
    if PY3:
        expect(opposite).when.called.to.throw(
            "'bar' should be in 'some string'")
    else:
        expect(opposite).when.called.to.throw(
            "u'bar' should be in u'some string'")

    expect(opposite_not).when.called.to.throw(AssertionError)
    if PY3:
        expect(opposite_not).when.called.to.throw(
            "'string' should NOT be in 'some string'")
    else:
        expect(opposite_not).when.called.to.throw(
            "u'string' should NOT be in u'some string'")
开发者ID:amukiza,项目名称:sure,代码行数:27,代码来源:test_assertion_builder.py


示例9: 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 r"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")

    expect(opposite).when.called.to.throw(AssertionError)
    expect(opposite).when.called.to.throw(compat_repr(
        "'John Doe' should differ to 'John Doe', but is the same thing"))

    expect(opposite_not).when.called.to.throw(AssertionError)
    expect(opposite_not).when.called.to.throw(compat_repr(
        "X is 'John Doe' whereas Y is 'Foo'"))
开发者ID:amukiza,项目名称:sure,代码行数:30,代码来源:test_assertion_builder.py


示例10: test_alloc_all_the_bridges

 def test_alloc_all_the_bridges(self):
     """Set the needed number of bridges to the default"""
     needed = '*'
     distname = "test-distributor"
     bucket = Bucket.BucketData(distname, needed)
     this(bucket.name).should.be.equal(distname)
     this(bucket.needed).should.be.equal(Bucket.BUCKET_MAX_BRIDGES)
开发者ID:liudonghua123,项目名称:bridgedb,代码行数:7,代码来源:test_Bucket.py


示例11: test_alloc_some_of_the_bridges

 def test_alloc_some_of_the_bridges(self):
     """Set the needed number of bridges"""
     needed = 10
     distname = "test-distributor"
     bucket = Bucket.BucketData(distname, needed)
     this(bucket.name).should.be.equal(distname)
     this(bucket.needed).should.be.equal(needed)
开发者ID:liudonghua123,项目名称:bridgedb,代码行数:7,代码来源:test_Bucket.py


示例12: test_order_callback

def test_order_callback():
    """
    The example from the callbacks doc
    https://coinbase.com/docs/merchant_tools/callbacks
    """
    this(CoinbaseOrder.parse_callback(callback_body)) \
        .should.be.equal(expected_order)
开发者ID:LawnmowerIO,项目名称:coinbase_python,代码行数:7,代码来源:test_order_callback.py


示例13: 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


示例14: test_missingPrefix

 def test_missingPrefix(self):
     """Changed to allow a missing 'a' prefix in branch
     ``hotfix/9462B-netstatus-returns-None``.
     """
     self.line = '%s:1234' % self.oraddr
     ip, port = networkstatus.parseALine(self.line)
     this(ip).should.be.a(basestring)
     this(port).should.be(None)
开发者ID:gsathya,项目名称:bridgedb,代码行数:8,代码来源:test_parse_networkstatus.py


示例15: test_invalidNicknameNonAlphanumeric

 def test_invalidNicknameNonAlphanumeric(self):
     """Test a line with a non-alphanumeric router nickname."""
     self.makeRLine(nick='abcdef/*comment*/')
     fields = networkstatus.parseRLine(self.line)
     nick, ident, desc = fields[:3]
     this(nick).should.be(None)
     the(ident).should.be.a(basestring)
     the(desc).should.be(None)
开发者ID:gsathya,项目名称:bridgedb,代码行数:8,代码来源:test_parse_networkstatus.py


示例16: test_stateCreation

    def test_stateCreation(self):
        this(self.state).should.be.ok

        this(self.state).should.have.property('config').being.ok
        this(self.state).should.have.property('config').being.equal(self.config)

        this(self.state.options).should.be.ok
        this(self.state.options).should.equal(self.options)
开发者ID:gsathya,项目名称:bridgedb,代码行数:8,代码来源:test_persistent.py


示例17: test_retrieve_balance

    def test_retrieve_balance(self):

        HTTPretty.register_uri(HTTPretty.GET, "https://coinbase.com/api/v1/account/balance",
                               body='''{"amount":"0.00000000","currency":"BTC"}''',
                               content_type='text/json')

        this(float(self.account.balance)).should.equal(0.0)
        this(self.account.balance.currency).should.equal('BTC')
开发者ID:sylvainblot,项目名称:coinbase_python,代码行数:8,代码来源:tests.py


示例18: test_buy_price_2

    def test_buy_price_2(self):

        HTTPretty.register_uri(HTTPretty.GET, "https://coinbase.com/api/v1/prices/buy?qty=10",
                               body='''{"amount":"633.25","currency":"USD"}''',
                               content_type='text/json')

        buy_price_10 = self.account.buy_price(10)
        this(buy_price_10).should.be.greater_than(100)
开发者ID:Mondego,项目名称:pyreco,代码行数:8,代码来源:allPythonContent.py


示例19: test_invalidNicknameTooLong

 def test_invalidNicknameTooLong(self):
     """Test a line with a router nickname which is way too long."""
     self.makeRLine(nick='ThisIsAReallyReallyLongRouterNickname')
     fields = networkstatus.parseRLine(self.line)
     nick, ident, desc = fields[:3]
     this(nick).should.be(None)
     the(ident).should.be.a(basestring)
     the(desc).should.be(None)
开发者ID:gsathya,项目名称:bridgedb,代码行数:8,代码来源:test_parse_networkstatus.py


示例20: test_order_list

    def test_order_list(self):

        HTTPretty.register_uri(HTTPretty.GET, "https://coinbase.com/api/v1/orders",
                               body='''{"orders":[{"order":{"id":"A7C52JQT","created_at":"2013-03-11T22:04:37-07:00","status":"completed","total_btc":{"cents":100000000,"currency_iso":"BTC"},"total_native":{"cents":3000,"currency_iso":"USD"},"custom":"","button":{"type":"buy_now","name":"Order #1234","description":"order description","id":"eec6d08e9e215195a471eae432a49fc7"},"transaction":{"id":"513eb768f12a9cf27400000b","hash":"4cc5eec20cd692f3cdb7fc264a0e1d78b9a7e3d7b862dec1e39cf7e37ababc14","confirmations":0}}}],"total_count":1,"num_pages":1,"current_page":1}''',
                               content_type='text/json')

        orders = self.account.orders()
        this(orders).should.be.a(list)
        this(orders[0].order_id).should.equal("A7C52JQT")
开发者ID:sylvainblot,项目名称:coinbase_python,代码行数:9,代码来源:tests.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python compat.compat_repr函数代码示例发布时间:2022-05-27
下一篇:
Python sure.that函数代码示例发布时间: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