dimanche 11 février 2018

How to check output starting with ellipsis in Python's doctests

I have a method which outputs ......silence...... to represent no activity:

def silence(self):
     print('......silence......')

I have the following doctest written for the method:

>>> s = SmokeDetector()
>>> s.silence()
.......silence......

But when I run the doctest, I get the following error:

ValueError: line 4 of the docstring for smoke_detector4.SmokeDetector.silence lacks blank after ...: '.......silence......'

How do I fix this?

Aucun commentaire:

Enregistrer un commentaire