本文整理汇总了Python中membership.Membership.get_code方法的典型用法代码示例。如果您正苦于以下问题:Python Membership.get_code方法的具体用法?Python Membership.get_code怎么用?Python Membership.get_code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membership.Membership
的用法示例。
在下文中一共展示了Membership.get_code方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MembershipTest
# 需要导入模块: from membership import Membership [as 别名]
# 或者: from membership.Membership import get_code [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())