def test_attribute_before(): result = parse(['before', ['get', 'attr'], '2000-01-01T00:00:01Z']) assert result == ast.TimeBefore( ast.Attribute('attr'), datetime(2000, 1, 1, 0, 0, 1, tzinfo=StaticTzInfo('Z', timedelta(0))), )
def test_id_in_list(): result = parse(['in', ['id'], 'someID', 'anotherID']) assert result == ast.In(ast.Attribute('id'), ['someID', 'anotherID'], False)
def test_attribute_gte_literal(): result = parse('{"op": "gte", "args":[{ "property": "attr" }, 5]}') assert result == ast.GreaterEqual( ast.Attribute("attr"), 5.0, )
def test_attribute_lt_literal(): result = parse('{"op": "lt", "args": [{ "property": "attr" }, 5]}') assert result == ast.LessThan( ast.Attribute("attr"), 5.0, )
def test_attribute_eq_literal(): result = parse('{ "op": "eq", "args":[{ "property": "attr" }, "A"]}') assert result == ast.Equal( ast.Attribute("attr"), "A", )
def test_attribute_is_null(): result = parse({"op": "isNull", "args": {"property": "attr"}}) assert result == ast.IsNull(ast.Attribute("attr"), False)