Changeset 92

Show
Ignore:
Timestamp:
07/19/06 14:02:31 (7 years ago)
Author:
mk
Message:

Added missing unit tests for discover_file_type function and Index class.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/mk/cheesecake/cheesecake_index.py

    r89 r92  
    9999    >>> discover_file_type('some/directory/junk.pyc') 
    100100    'pyc' 
     101    >>> discover_file_type('examples/readme.txt') 
     102    >>> discover_file_type('examples/runthis.py') 
     103    'demo' 
    101104    """ 
    102105    dirs = filename.split(os.path.sep) 
  • branches/mk/tests/unit/test_index_class.py

    r80 r92  
    33    >>> import _path_cheesecake 
    44    >>> from cheesecake.cheesecake_index import Index 
     5 
     6***** 
     7 
     8Default maximum value for an index should be 0. 
     9    >>> index = Index() 
     10    >>> index.max_value 
     11    0 
     12 
     13***** 
    514 
    615Create two indices. 
     
    2534    False 
    2635 
     36***** 
     37 
     38Test passing subindices to index constructor. 
     39    >>> def create_index(name): 
     40    ...     idx = Index() 
     41    ...     idx.name = name 
     42    ...     return idx 
     43 
     44    >>> index_one = create_index('one') 
     45    >>> index_two = create_index('two') 
     46    >>> index_three = create_index('three') 
     47    >>> index = Index(index_one, index_two, index_three) 
     48 
     49    >>> def get_names(indices): 
     50    ...     return map(lambda idx: idx.name, indices) 
     51 
     52    >>> get_names(index.subindices) 
     53    ['one', 'two', 'three'] 
     54    >>> index.remove_subindex('one') 
     55    >>> get_names(index.subindices) 
     56    ['two', 'three'] 
     57 
     58***** 
     59 
    2760Test requirements. 
    2861    >>> class NewIndex(Index):