@@ -292,45 +292,63 @@ def test(self):
292
292
)
293
293
294
294
def test_doctest_linedata_on_property (self , testdir ):
295
- testdir .tmpdir .join ("hello.py" ).write (
296
- textwrap .dedent (
297
- """\
298
- class Sample(object):
299
- @property
300
- def some_property(self):
301
- '''
302
- >>> Sample().some_property
303
- 'another thing'
304
- '''
305
- return 'something'
306
- """
307
- )
295
+ testdir .makepyfile (
296
+ """
297
+ class Sample(object):
298
+ @property
299
+ def some_property(self):
300
+ '''
301
+ >>> Sample().some_property
302
+ 'another thing'
303
+ '''
304
+ return 'something'
305
+ """
308
306
)
309
307
result = testdir .runpytest ("--doctest-modules" )
310
- result .stdout .fnmatch_lines (["*hello*" , "005*>>> Sample().some_property" ])
308
+ result .stdout .fnmatch_lines (
309
+ [
310
+ "*= FAILURES =*" ,
311
+ "*_ [doctest] test_doctest_linedata_on_property.Sample.some_property _*" ,
312
+ "004 " ,
313
+ "005 >>> Sample().some_property" ,
314
+ "Expected:" ,
315
+ " 'another thing'" ,
316
+ "Got:" ,
317
+ " 'something'" ,
318
+ "" ,
319
+ "*/test_doctest_linedata_on_property.py:5: DocTestFailure" ,
320
+ "*= 1 failed in *" ,
321
+ ]
322
+ )
311
323
312
324
def test_doctest_no_linedata_on_overriden_property (self , testdir ):
313
- testdir .tmpdir .join ("hello.py" ).write (
314
- textwrap .dedent (
315
- """\
316
- class Sample(object):
317
- @property
318
- def some_property(self):
319
- '''
320
- >>> Sample().some_property
321
- 'another thing'
322
- '''
323
- return 'something'
324
- some_property = property(some_property.__get__, None, None, some_property.__doc__)
325
- """
326
- )
325
+ testdir .makepyfile (
326
+ """
327
+ class Sample(object):
328
+ @property
329
+ def some_property(self):
330
+ '''
331
+ >>> Sample().some_property
332
+ 'another thing'
333
+ '''
334
+ return 'something'
335
+ some_property = property(some_property.__get__, None, None, some_property.__doc__)
336
+ """
327
337
)
328
338
result = testdir .runpytest ("--doctest-modules" )
329
339
result .stdout .fnmatch_lines (
330
340
[
331
- "*hello*" ,
332
- "*EXAMPLE LOCATION UNKNOWN, not showing all tests of that example*" ,
333
- "???*>>> Sample().some_property" ,
341
+ "*= FAILURES =*" ,
342
+ "*_ [doctest] test_doctest_no_linedata_on_overriden_property.Sample.some_property _*" ,
343
+ "EXAMPLE LOCATION UNKNOWN, not showing all tests of that example" ,
344
+ "??? >>> Sample().some_property" ,
345
+ "Expected:" ,
346
+ " 'another thing'" ,
347
+ "Got:" ,
348
+ " 'something'" ,
349
+ "" ,
350
+ "*/test_doctest_no_linedata_on_overriden_property.py:None: DocTestFailure" ,
351
+ "*= 1 failed in *" ,
334
352
]
335
353
)
336
354
0 commit comments