11# -*- encoding:utf-8 -*-
22from __future__ import division , absolute_import , print_function
33
4+ from collections import namedtuple
45import re
56import sys
67import textwrap
78import warnings
89
910import jinja2
1011
12+ from numpydoc .numpydoc import update_config
1113from numpydoc .docscrape import (
1214 NumpyDocString ,
1315 FunctionDoc ,
@@ -382,11 +384,11 @@ def _strip_blank_lines(s):
382384 return s
383385
384386
385- def line_by_line_compare (a , b ):
387+ def line_by_line_compare (a , b , n_lines = None ):
386388 a = textwrap .dedent (a )
387389 b = textwrap .dedent (b )
388- a = [l .rstrip () for l in _strip_blank_lines (a ).split ('\n ' )]
389- b = [l .rstrip () for l in _strip_blank_lines (b ).split ('\n ' )]
390+ a = [l .rstrip () for l in _strip_blank_lines (a ).split ('\n ' )][: n_lines ]
391+ b = [l .rstrip () for l in _strip_blank_lines (b ).split ('\n ' )][: n_lines ]
390392 assert len (a ) == len (b )
391393 for ii , (aa , bb ) in enumerate (zip (a , b )):
392394 assert aa == bb
@@ -518,8 +520,7 @@ def test_yield_str():
518520 The number of bananas.
519521int
520522 The number of unknowns.
521-
522- .. index:: """ )
523+ """ )
523524
524525
525526def test_receives_str ():
@@ -537,8 +538,7 @@ def test_receives_str():
537538 The number of bananas.
538539c : int
539540 The number of oranges.
540-
541- .. index:: """ )
541+ """ )
542542
543543
544544def test_no_index_in_str ():
@@ -1200,8 +1200,6 @@ def test_class_members_doc():
12001200 b
12011201 c
12021202
1203- .. index::
1204-
12051203 """ )
12061204
12071205
@@ -1422,7 +1420,7 @@ def test_autoclass():
14221420.. rubric:: Methods
14231421
14241422
1425- ''' )
1423+ ''' , 5 )
14261424
14271425
14281426xref_doc_txt = """
@@ -1442,7 +1440,7 @@ def test_autoclass():
14421440 List of integers
14431441p4 : :class:`pandas.DataFrame`
14441442 A dataframe
1445- p5 : sequence of int
1443+ p5 : sequence of ` int`
14461444 A sequence
14471445
14481446Returns
@@ -1458,37 +1456,39 @@ def test_autoclass():
14581456
14591457:Parameters:
14601458
1461- **p1** : :xref_param_type:` int`
1459+ **p1** : :class:`python: int`
14621460 Integer value
14631461
1464- **p2** : :xref_param_type:` float`, optional
1462+ **p2** : :class:`python: float`, optional
14651463 Integer value
14661464
14671465:Returns:
14681466
1469- **out** : :xref_param_type :`array <numpy.ndarray>`
1467+ **out** : :obj :`array <numpy.ndarray>`
14701468 Numerical return value
14711469
14721470
14731471:Other Parameters:
14741472
1475- **p3** : :xref_param_type:` list`\[:xref_param_type:` int`]
1473+ **p3** : :class:`python: list`\[:class:`python: int`]
14761474 List of integers
14771475
14781476 **p4** : :class:`pandas.DataFrame`
14791477 A dataframe
14801478
1481- **p5** : :term :`python:sequence` of :xref_param_type: `int`
1479+ **p5** : :obj :`python:sequence` of `int`
14821480 A sequence
14831481"""
14841482
14851483
14861484def test_xref ():
14871485 xref_aliases = {
1488- 'sequence' : ':term:`python:sequence`' ,
1489- 'iterable' : ':term:`python:iterable`' ,
1490- 'array' : 'numpy.ndarray' ,
1486+ 'sequence' : ':obj:`python:sequence`' ,
14911487 }
1488+ config = namedtuple ('numpydoc_xref_aliases' ,
1489+ 'numpydoc_xref_aliases' )(xref_aliases )
1490+ app = namedtuple ('config' , 'config' )(config )
1491+ update_config (app )
14921492
14931493 xref_ignore = {'of' , 'default' , 'optional' }
14941494
0 commit comments