# Path: datafs/_compat.py
# def open_filelike(filelike, mode='r'):


import pytest
from datafs._compat import u

        # Make sure leading slash isn't a problem:
        arch3 = api.get_archive('/my/new/archive.txt')
        assert arch3 == arch

        # Make sure authority name isn't a problem:
        arch4 = api.get_archive('filesys://my/new/archive.txt')
        assert arch4 == arch

        # Make sure the wrong authority name is a problem:
        with pytest.raises(ValueError):
            api.get_archive('localhost://my/new/archive.txt')

    finally:
        arch.delete()


def test_archive_creation_with_multiple_authorities(api_dual_auth):
    '''
    Addresses :issue:`220`
    '''

    arch = api_dual_auth.create('auth1://my/new/archive.txt')

    try:
        # Make sure we can get the archive:
        arch1 = api_dual_auth.get_archive('my/new/archive.txt')
        assert arch1 == arch

        # Make sure str/unicode isn't a problem:

# Path: datafs/_compat.py
# def open_filelike(filelike, mode='r'):


# Path: tests/test_users.py
import pytest
from datafs._compat import u


        # Make sure leading slash isn't a problem:
        arch3 = api.get_archive('/my/new/archive.txt')
        assert arch3 == arch

        # Make sure authority name isn't a problem:
        arch4 = api.get_archive('filesys://my/new/archive.txt')
        assert arch4 == arch

        # Make sure the wrong authority name is a problem:
        with pytest.raises(ValueError):
            api.get_archive('localhost://my/new/archive.txt')

    finally:
        arch.delete()


def test_archive_creation_with_multiple_authorities(api_dual_auth):
    '''
    Addresses :issue:`220`
    '''

    arch = api_dual_auth.create('auth1://my/new/archive.txt')

    try:
        # Make sure we can get the archive:
        arch1 = api_dual_auth.get_archive('my/new/archive.txt')
        assert arch1 == arch

        # Make sure str/unicode isn't a problem:

        arch2 = api_dual_auth.get_archive(u('my/new/archive.txt'))