Changeset 9938:e560a724d80c in orange


Ignore:
Timestamp:
02/07/12 18:21:49 (2 years ago)
Author:
Jure Zbontar <jure.zbontar@…>
Branch:
default
Message:

Fixed failing doctest in misc/init.py

Location:
Orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/misc/__init__.py

    r9937 r9938  
    2222 
    2323        Can be ``SymMatrix.Lower`` (0), ``SymMatrix.Upper`` (1),  
    24         ``SymMatrix.Symmetric`` (2, default), ``SymMatrix.Lower_Filled`` (3) or 
     24        ``SymMatrix.Symmetric`` (2, default), ``SymMatrix.LowerFilled`` (3) or 
    2525        ``SymMatrix.Upper_Filled`` (4).  
    2626 
    2727        If the matrix type is ``Lower`` or ``Upper``, indexing  
    2828        above or below the diagonal, respectively, will fail.  
    29         With ``Lower_Filled`` and ``Upper_Filled``, 
     29        With ``LowerFilled`` and ``Upper_Filled``, 
    3030        the elements upper or lower, respectively, still  
    3131        exist and are set to zero, but they cannot be modified. The  
     
    3535        If matrix type is ``Upper``, it is printed as: 
    3636 
     37        >>> import Orange 
     38        >>> m = Orange.misc.SymMatrix( 
     39        ...     [[1],  
     40        ...      [2, 4],  
     41        ...      [3, 6, 9],  
     42        ...      [4, 8, 12, 16]]) 
    3743        >>> m.matrix_type = m.Upper 
    3844        >>> print m 
     
    4248         (                        16.000)) 
    4349 
    44         Changing the type to ``Lower_Filled`` changes the printout to 
    45  
    46         >>> m.matrix_type = m.Lower_Filled 
     50        Changing the type to ``LowerFilled`` changes the printout to 
     51 
     52        >>> m.matrix_type = m.LowerFilled 
    4753        >>> print m 
    4854        (( 1.000,  0.000,  0.000,  0.000), 
     
    145151if ``m`` is a SymMatrix, then ``m[2, 4]`` addresses the same element as ``m[4, 2]``. 
    146152 
    147 .. literalinclude:: code/symmatrix.py 
    148     :lines: 1-6 
     153.. 
     154    .. literalinclude:: code/symmatrix.py 
     155        :lines: 1-6 
     156 
     157>>> import Orange 
     158>>> m = Orange.misc.SymMatrix(4) 
     159>>> for i in range(4): 
     160...    for j in range(i+1): 
     161...        m[i, j] = (i+1)*(j+1) 
     162 
    149163 
    150164Although only the lower left half of the matrix was set explicitely,  
     
    161175 
    162176>>> print m[1] 
    163 (3.0, 6.0, 9.0, 0.0) 
     177(2.0, 4.0, 6.0, 8.0) 
    164178>>> m.matrix_type = m.Lower 
    165179>>> for row in m: 
     
    682696    """ Return a property object that accesses an attribute named `new_name` 
    683697    and raises a deprecation warning when doing so. 
     698 
     699    .. 
     700 
     701        >>> sys.stderr = sys.stdout 
    684702     
    685703    Example :: 
     
    693711        >>> a = A() 
    694712        >>> print a.myAttr 
    695         __main__:1: DeprecationWarning: 'myAttr' is deprecated. Use 'my_attr' instead! 
     713        ...:1: DeprecationWarning: 'myAttr' is deprecated. Use 'my_attr' instead! 
    696714        123 
    697715         
  • Orange/testing/doctest/dtest.py

    r9937 r9938  
    3838 
    3939def load_tests(loader, tests, ignore): 
    40     exclude_dirs = ['/orng/', '/doc/', '/unit/', '/testing/', '/multilabel/'] 
     40    exclude_dirs = ['/orng/', '/doc/', '/unit/', '/testing/', '/multilabel/', '/OrangeWidgets/'] 
    4141    for fname in get_files(base_dirs, ['.py']): 
    4242        if any(dir in fname for dir in exclude_dirs): 
    4343            continue 
    44         print(fname) 
     44        #print(fname) 
    4545        path, package = getpackage(fname) 
    4646        sys.path.insert(0, os.path.split(fname)[0]) 
     
    5656 
    5757if __name__ == '__main__': 
    58     base_dirs = [os.path.abspath('../..')] 
     58    base_dirs = [os.path.abspath('../../misc')] 
    5959    unittest.main() 
Note: See TracChangeset for help on using the changeset viewer.