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


Python Membership.set_name方法代码示例

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


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

示例1: MembershipTest

# 需要导入模块: from membership import Membership [as 别名]
# 或者: from membership.Membership import set_name [as 别名]
class MembershipTest(unittest.TestCase):

    def setUp(self):
        """Setup method to instance an object of Membership class """
        code = 9
        name = "Gold"
        discount = 10
        self.membership = Membership(code, name, discount)
        self.test_membership = Membership(5, "Platinum", 5)
        
    def test_create_membership(self):
        """Test if an instance is created with the required data"""
        self.assertIsInstance(self.test_membership, Membership)
        
    def test_set_code_of_membership(self):
        """Test to update the membership code"""
        other_code = 10
        self.test_membership.set_code(other_code)
        self.assertEqual(other_code, self.test_membership.get_code())
        
    def test_set_name_of_membership(self):
        """ Test to update the membership name"""
        other_name = "Platinum"
        self.test_membership.set_name(other_name)
        self.assertEqual(other_name, self.test_membership.get_name())
        
    def test_set_discont_of_membership(self):
        """ Test to update the membership discount"""
        other_discount = 11
        self.test_membership.set_discount(other_discount)
        self.assertEqual(other_discount, self.test_membership.get_discount())
开发者ID:grettarocha,项目名称:DEVFUNDA,代码行数:33,代码来源:membership_test.py


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