<s> """<STR_LIT>""" <EOL> __docformat__ = '<STR_LIT>' <EOL> from os . path import basename <EOL> from mock import patch <EOL> from nose . tools import assert_is_instance , assert_in , assert_not_in <EOL> from ... utils import swallow_logs <EOL> from ... api import register_collection , list_collections <EOL> from ... tests . utils import ok_ , eq_ , assert_cwd_unchanged , assert_raises , with_testrepos , with_tempfile <EOL> from ... cmdline . helpers import get_datalad_master <EOL> from ... support . collection import Collection <EOL> @ assert_cwd_unchanged <EOL> @ with_testrepos ( '<STR_LIT>' , flavors = [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> @ with_tempfile ( mkdir = True ) <EOL> def test_list_collections ( collection_url , lcpath ) : <EOL> class mocked_dirs : <EOL> user_data_dir = lcpath <EOL> with patch ( '<STR_LIT>' , mocked_dirs ) , swallow_logs ( ) as cml : <EOL> register_collection ( collection_url ) <EOL> new_list = list_collections ( ) <EOL> for item in new_list : <EOL> assert_is_instance ( item , Collection ) <EOL> assert_in ( basename ( collection_url ) , [ c . name for c in new_list ] ) <EOL> assert_in ( collection_url . rstrip ( '<STR_LIT:/>' ) , <EOL> [ c . url . rstrip ( '<STR_LIT:/>' ) for c in new_list ] ) </s>
