python小技巧:自动化封装基础之继承

本人较懒,不喜欢废话,直接上代码,大家自己意会。

# author:闫振兴
# contact: [email protected]
# datetime:2020/4/19 18:56
# software: PyCharm
"""
文件说明:
"""
#encoding:utf-8
class father():
    def __init__(self):
        print("我是爸爸A呀")
    def father_way(self):
        print("我是爸爸的方法:father_way")
# author:闫振兴
# contact: [email protected]
# datetime:2020/4/19 18:56
# software: PyCharm
"""
文件说明:
"""
#encoding:utf-8
from 继承.AA import father
class son(father):
    def way(self):
        print("我是儿子方法A")
# author:闫振兴
# contact: [email protected]
# datetime:2020/4/19 18:56
# software: PyCharm
"""
文件说明:
"""
#encoding:utf-8
import unittest
import 继承.BB as Son

class MyTestCase(unittest.TestCase):
    def test_something(self):
        son=Son.son()
        son.way()
        son.way()
        son.way()
        son.father_way()
        self.assertEqual(True, True)


if __name__ == '__main__':
    unittest.main()

 

猜你喜欢

转载自blog.csdn.net/pingsha_luoyan/article/details/105620215