Skip to content

Failed

OmeroWeb.test.integration.test_table.TestOmeroTables.test_table_bitmask[query_result1] (from pytest)

Failing for the past 2 builds (Since #95 )
Took 3 sec.

Error Message

AssertionError: assert False
 +  where False = <built-in method startswith of str object at 0x7fef4c876810>('001100')
 +    where <built-in method startswith of str object at 0x7fef4c876810> = '01111011001000100110010101110010011100100110111101110010001000100011101000100000001000100101010101101110011010110110111001101111011101110110111000100000011000110110111101101100011101010110110101101110001000000110111101100010011010100110010101100011011101000010001001111101'.startswith

Stacktrace

self = <test_table.TestOmeroTables object at 0x7fef4c47d700>
omero_table_file = 5948
django_client = <django.test.client.Client object at 0x7fefd0d8ceb0>
query_result = ['query=SmallNumbers>0.5', '001100']

    @pytest.mark.parametrize("query_result", [
        # Wells 3,4,5 are True for query
        ['query=Well>2', "000111"],
        # Wells 2 & 3 are True for query
        ['query=SmallNumbers>0.5', "001100"],
        # Well 5 is True for query
        ["query=SmallNumbers<0.1&col_name=Well", "000001"],
        # IDs 4 & 6 are True for query
        ['query=SmallNumbers>0.5&col_name=IDs', "0000101"],
    ])
    def test_table_bitmask(self, omero_table_file,
                           django_client, query_result):
        """
        Test query of table data as bitmask.
    
        Resulting IDs are represented as a bit mask where the index of each ID
        in the bit mask is shown as 1.
        E.g. 1,3 & 6 => "0101001" (maybe extra 0 added)
        """
        file_id = omero_table_file
    
        request_url = reverse("webgateway_table_obj_id_bitmask",
                              args=[file_id])
        query, expected = query_result
        url = request_url + '?%s' % query
        rsp = get(django_client, url)
        bitmask = rsp.content
        # convert string into byte array and unpack
        numbers = [int(by) for by in bitmask]
        bits = np.unpackbits(np.array(numbers, dtype=np.uint8))
        # convert bits to string for comparison
        bitStr = ''.join([str(b) for b in bits])
>       assert bitStr.startswith(expected)
E       AssertionError: assert False
E        +  where False = <built-in method startswith of str object at 0x7fef4c876810>('001100')
E        +    where <built-in method startswith of str object at 0x7fef4c876810> = '01111011001000100110010101110010011100100110111101110010001000100011101000100000001000100101010101101110011010110110111001101111011101110110111000100000011000110110111101101100011101010110110101101110001000000110111101100010011010100110010101100011011101000010001001111101'.startswith

test/integration/test_table.py:219: AssertionError