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


Python Account.get_account方法代码示例

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


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

示例1: test_account_returns_data_for_id_1

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_account [as 别名]
 def test_account_returns_data_for_id_1(self):
     account_data = {"id": "1", "name": "test"}
     mock_data_interface = Mock()
     mock_data_interface.get.return_value = account_data
     account = Account(mock_data_interface)
     self.assertDictEqual(account_data, account.get_account(1))
开发者ID:griffinb,项目名称:py-tdd,代码行数:8,代码来源:account_test.py

示例2:

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_account [as 别名]
# set up a terminal emulator
screen = pyte.Screen(80, 24)
stream = pyte.Stream()
stream.attach(screen)

tn = telnetlib.Telnet(SITE_IP)
time.sleep(1)

# read content
content = tn.read_very_eager().decode('uao_decode', 'ignore')


# login
if '請輸入代號' in content:
    # write account id
    tn.write((account.get_account() + '\r\n').encode('big5'))
    time.sleep(1)
    content = tn.read_very_eager().decode('uao_decode', 'ignore')

    # write password
    tn.write((account.get_password() + '\r\n').encode('big5'))
    time.sleep(2)
    content = tn.read_very_eager().decode('uao_decode', 'ignore')

    # check if password incorrect
    if '密碼不對' in content:
        sys.exit()

    # check if exists a session
    if '您想刪除其他重複登入的連線嗎' in content:
        tn.write('Y\r\n'.encode('big5'))
开发者ID:mhwong2007,项目名称:PTT-Crawler,代码行数:33,代码来源:ptt-crawler.py

示例3: test_account_when_connect_exception_raised

# 需要导入模块: from account import Account [as 别名]
# 或者: from account.Account import get_account [as 别名]
 def test_account_when_connect_exception_raised(self):
     mock_data_interface = Mock()
     mock_data_interface.get.side_effect = ConnectionError()
     account = Account(mock_data_interface)
     self.assertEqual("Connection error occurred. Try again.", account.get_account(1))
开发者ID:griffinb,项目名称:py-tdd,代码行数:7,代码来源:account_test.py


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