doc文件系统差不多了
来学一下怎麽做测试
首先当然是安装pytest
pip install pytest
然後建立如下的资料夹跟档案
test_field/libs/module.py
class Module:
@staticmethod
def get_true():
return True
@staticmethod
def get_false():
return False
test_field/test/test_module.py
from libs.module import Module
def test_get_true_func():
assert Module.get_true() is True
def test_get_false_func():
assert Module.get_false() is False
然後cd到test_field
如果直接执行
pytest
会出现找不到libs.module的错误
带入-m来执行的话则会成功
这似乎是跟路径、脚本有相关的 我其实没有很理解 但先这样练习吧
python -m pytest
「物件将它们的资料隐藏在抽象层後方,然後将操纵这些资料的函式暴露在外。资料结构则将资料暴露在外,且...
建立搜索用gem 'ransack'不好吗? 完整又便利。 真的.....但是有些小东西,自己刻一个...
在切回去写 domain layer 之前,我们先把之前写好的 data layer class 补...
前言 通过Hero,我们可以在两个路由之间做出流畅的转场动画,Hero会在Source、Overla...
前言 中场休息过後,来看一下LFI和RFI吧! 正文 LFI LFI全称Local File Inc...