# Some basic test code
from ds_store import DSStore
import os

def test_create(tmpdir):
    """Test that we can create a .DS_Store file successfully."""
    store_name = str(tmpdir/'.DS_Store')

    with DSStore.open(store_name, 'w+') as store:
        pass

    assert os.path.exists(store_name)

    os.unlink(store_name)

def test_can_read(tmpdir):
    """Test that we can retrieve data from a .DS_Store file written by
    OS X."""
    with DSStore.open('tests/Test_DS_Store', 'r') as store:
        assert store['bam']['Iloc'] == (104, 116)
        assert store['bar']['Iloc'] == (256, 235)
        assert store['baz']['Iloc'] == (454, 124)

def test_holds_data(tmpdir):
    """Test that we can retrieve a key from a .DS_Store file that we stored
    into it earlier."""
    store_name = str(tmpdir/'.DS_Store')

    with DSStore.open(store_name, 'w+') as store:
        store['foobar.dat']['note'] = ('ustr', u'Hello World!')

    assert os.path.exists(store_name)

    with DSStore.open(store_name, 'r') as store:
        assert store['foobar.dat']['note'] == (b'ustr', u'Hello World!')

    os.unlink(store_name)

@@ -1094,28 +1094,331 @@
 %0A%0A    os.unlink(store_name)%0A
+%0Adef test_find(tmpdir):%0A    %22%22%22Test that we can find records with and without a code%22%22%22%0A    with DSStore.open('tests/Test_DS_Store', 'r') as store:%0A        bamIloc = list(store.find('bam',code='Iloc'))%0A        assert len(bamIloc) == 1%0A        bam = list(store.find('bam'))%0A        assert bamIloc == bam%0A

Add test for bug fix