小编nim*_*mda的帖子

如何配置sbt test/ScalaTest只显示失败?

是否有办法将测试结果截断为仅在单元测试失败时才显示单元测试的结果文本?我正在开发一个包含850个单元测试的Scala项目,成功的单元测试中的绿色文本使得很难专注于失败.

我在说什么的例子:

[info] - should have colors
[info] - should not be dead
//.... x 100
[info] - animals should not be rainbows *** FAILED *** 
[info] -"[rainbow]s" was not equal to "[ponie]s" (HappinessSpec.scala:31)
Run Code Online (Sandbox Code Playgroud)

我想要的只是显示失败的东西:

[info] - animals should not be rainbows *** FAILED *** 
[info] -"[rainbow]s" was not equal to "[ponie]s" (HappinessSpec.scala:31)
Run Code Online (Sandbox Code Playgroud)

我意识到有test-quicksbt命令,但是在我的情况下它仍然运行300次成功的单元测试,当时只有30次失败.

在使用方面,我正在寻找的东西:

sbt> ~ test -showOnlyFailures

我也很高兴能够在运行单元测试结束时显示所有失败.IIRC,这就是RSpec在Ruby中的工作方式......

scala sbt scalatest

20
推荐指数
2
解决办法
3779
查看次数

Python 3.5+中的递归键入

在Python 3.5中,添加了类型注释(参见此处).

有没有一种定义递归类型注释的方法,例如树状结构?

class Employee(object):
    def __init__(self, name: str, reports: List[Employee]):
       self.name = name
       self.reports = reports
Run Code Online (Sandbox Code Playgroud)

在上面,似乎注释不起作用List[Employee].运行代码会导致此错误:

NameError: name 'Employee' is not defined

python recursion type-hinting python-3.x

13
推荐指数
1
解决办法
3569
查看次数

标签 统计

python ×1

python-3.x ×1

recursion ×1

sbt ×1

scala ×1

scalatest ×1

type-hinting ×1