本文整理汇总了Python中hamcrest.starts_with方法的典型用法代码示例。如果您正苦于以下问题:Python hamcrest.starts_with方法的具体用法?Python hamcrest.starts_with怎么用?Python hamcrest.starts_with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hamcrest
的用法示例。
在下文中一共展示了hamcrest.starts_with方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validate_monthly_account
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import starts_with [as 别名]
def validate_monthly_account(context):
acct_repository = AccountRepository(context.db)
membership = acct_repository.get_active_account_membership(
context.accounts['foo'].id
)
assert_that(
membership.type,
equal_to(MONTHLY_MEMBERSHIP)
)
assert_that(membership.payment_account_id, starts_with('cus'))
assert_that(membership.start_date, equal_to(date.today()))
assert_that(membership.end_date, none())
示例2: yearly_account
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import starts_with [as 别名]
def yearly_account(context):
acct_repository = AccountRepository(context.db)
membership = acct_repository.get_active_account_membership(
context.accounts['foo'].id
)
assert_that(membership.type, equal_to(YEARLY_MEMBERSHIP))
assert_that(membership.payment_account_id, starts_with('cus'))
示例3: test_connect_timeout
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import starts_with [as 别名]
def test_connect_timeout(self):
with self.assertRaises(ConnectTimeout) as expect:
self.client("10.0.0.0", "whatever", "whatever", connect_timeout=1)
assert_that(str(expect.exception), starts_with("Timed out while connecting to 10.0.0.0 on port"))
示例4: test_get_type_fields
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import starts_with [as 别名]
def test_get_type_fields(self):
t = UnityType(_id='type')
assert_that(t.fields_str, starts_with(
'name,description,documentation,type,attributes.name'))
示例5: test_fields_str
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import starts_with [as 别名]
def test_fields_str(self):
t = UnityType(_id='lun', cli=t_rest())
assert_that(t.fields_str, starts_with('auSize,creationTime,'))
示例6: test_fake_switches_entrypoint_cisco_generic
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import starts_with [as 别名]
def test_fake_switches_entrypoint_cisco_generic(self):
p = subprocess.Popen(get_base_args() + ["--listen-host", TEST_BIND_HOST,
"--listen-port", TEST_BIND_PORT])
time.sleep(1)
handshake = connect_and_read_bytes(TEST_BIND_HOST, TEST_BIND_PORT,
byte_count=8, retry_count=10)
p.terminate()
assert_that(handshake, starts_with('SSH-2.0'))
示例7: has_test_case
# 需要导入模块: import hamcrest [as 别名]
# 或者: from hamcrest import starts_with [as 别名]
def has_test_case(name, *matchers):
return has_property('test_cases',
has_item(
all_of(
any_of(
has_entry('fullName', ends_with(name)),
has_entry('name', starts_with(name))
),
*matchers
)
)
)