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


Python Card.name方法代码示例

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


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

示例1: __parse_card_item

# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import name [as 别名]
 def __parse_card_item(self, text):
     card = Card()
     card.multiverseid = int(multiverseid_re.search(text).group(1))
     card.name = name_re.search(text).group(1)
     card.language = LANG_DICT[language_re.search(text).group(1)]
     # other attributes are set by Card.add_translation()
     return card
开发者ID:nuxgu,项目名称:magic_db,代码行数:9,代码来源:languages.py

示例2: TestCard

# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import name [as 别名]
class TestCard(unittest.TestCase):

    def setUp(self):
        self.twoOfClubs = Card(0)
        self.queenOfSpades = Card(43)

    def test_initialize(self):
        self.assertRaises(ValueError, Card, 52)

    def test_card_rank(self):
        self.assertEqual(self.twoOfClubs.rank(), "2")
        self.assertEqual(self.queenOfSpades.rank(), "Queen")

    def test_card_short_rank(self):
        self.assertEqual(self.twoOfClubs.short_rank(), "2")
        self.assertEqual(self.queenOfSpades.short_rank(), "Q")

    def test_card_suit(self):
        self.assertEqual(self.twoOfClubs.suit(), "Clubs")
        self.assertEqual(self.queenOfSpades.suit(), "Spades")
        
    def test_card_short_suit(self):
        self.assertEqual(self.twoOfClubs.short_suit(), "C")
        self.assertEqual(self.queenOfSpades.short_suit(), "S")
        
    def test_card_name(self):
        self.assertEqual(self.twoOfClubs.name(), "2 of Clubs")
        self.assertEqual(self.queenOfSpades.name(), "Queen of Spades")

    def test_card_short_name(self):
        self.assertEqual(self.twoOfClubs.short_name(), "2C")
        self.assertEqual(self.queenOfSpades.short_name(), "QS")
        
    def test_card_str(self):
        self.assertEqual(self.twoOfClubs.__str__(), "2 of Clubs")
        self.assertEqual(self.queenOfSpades.__str__(), "Queen of Spades")

    def test_card_repr(self):
        self.assertEqual(self.twoOfClubs.__repr__(), "<2C>")
        self.assertEqual(self.queenOfSpades.__repr__(), "<QS>")

    def test_card_comparison(self):
        self.assertTrue(self.twoOfClubs < self.queenOfSpades)
        queenOfHearts = Card(42)
        self.assertTrue(self.queenOfSpades == queenOfHearts)
开发者ID:FTWViolin,项目名称:summer_course,代码行数:47,代码来源:test_card.py

示例3: Card

# 需要导入模块: from card import Card [as 别名]
# 或者: from card.Card import name [as 别名]
f.write("]\n")
#f.write("}\n")


#
#
#Generating card JSON Objects
#
#

for cards in root.findall('cards'):
	for card in cards.findall('card'):

		temp_card = Card()
		temp_card.id = card.find('id').text
		temp_card.name = card.find('name').text
		temp_card.set = card.find('set').text
		temp_card.type = card.find('type').text
		temp_card.rarity = card.find('rarity').text


		temp_card.manacost = card.find('manacost').text or "Default"
		temp_card.converted_manacost = card.find('converted_manacost').text or "Default"
		temp_card.power = card.find('power').text or "Default"
		temp_card.toughness = card.find('toughness').text or "Default"
		temp_card.loyalty = card.find('loyalty').text or "Default"
		temp_card.ability = card.find('ability').text or "Default"
		#temp_card.flavor = card.find('flavor').text or "Default"
		if temp_card.id == 74256:
			temp_card.flavor = "Default"
		else:
开发者ID:LeShadow,项目名称:MTGProject,代码行数:33,代码来源:magic.py


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