【发布时间】:2021-05-14 13:37:52
【问题描述】:
我更新了 Python 假设,似乎 choices() 现在已被弃用。
文档对data() 和sampled_from() 进行了一些讨论,但不清楚应该如何使用它们来代替choices()。
我的代码看起来像这样:
@precondition(lambda self: not self.flash_light.crossed)
@rule(choice=st.choices)
def make_forward_move(self, choice):
persons = [x for x in self.persons if not x.crossed]
pers1 = choice(persons)
persons.remove(pers1)
pers2 = choice(persons)
【问题讨论】: