

def test_parse_set_query():
    '\n    Parse a bunch of set queries and make sure that the expected result\n    matches.\n    '
    set_tests = {
        'foo=bar': [('intersection', 'foo', 'bar')],
        'foo=bar owner=jathan': [('intersection', 'foo', 'bar'), ('intersection', 'owner', 'jathan')],
        '-owner=gary': [('difference', 'owner', 'gary')],
        'cluster +foo=baz': [('intersection', 'cluster', ''), ('union', 'foo', 'baz')],
        'cluster=lax   +foo=baz': [('intersection', 'cluster', 'lax'), ('union', 'foo', 'baz')],
        "usage='Internal Network'": [('intersection', 'usage', 'Internal Network')],
        'usage="Internal Network"': [('intersection', 'usage', 'Internal Network')],
    }
    for (query, expected_result) in set_tests.iteritems():
        result = parse_set_query(query)
        assert (result == expected_result)
    with pytest.raises(TypeError):
        parse_set_query(None)
    with pytest.raises(ValueError):
        parse_set_query('foo="bar')

dataset/ETHPy150Open dropbox/nsot/tests/api_tests/test_util.py test_parse_set_query/original