Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
  • Loading branch information
uhbrar committed Jul 29, 2022
1 parent d72499a commit c8e8ecc
Showing 1 changed file with 30 additions and 45 deletions.
75 changes: 30 additions & 45 deletions tests/test_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,36 @@

def test_condition():
"""Test condition generation."""
assert (
build_conditions(
**{
"a": 5,
}
)
== ("a == ?", (5,))
)
assert (
build_conditions(
**{
"a": 5,
"b": 4,
}
)
== ("(a == ?) AND (b == ?)", (5, 4))
)
assert (
build_conditions(
**{
"$or": [
{"a": 5},
{"b": 4},
],
"c": 3,
}
)
== ("((a == ?) OR (b == ?)) AND (c == ?)", (5, 4, 3))
)
assert (
build_conditions(
**{
"a": {"$ge": 5},
}
)
== ("a >= ?", (5,))
)
assert (
build_conditions(
**{
"a": {"$in": [1, 2]},
}
)
== ("a in (?, ?)", (1, 2))
)
assert build_conditions(
**{
"a": 5,
}
) == ("a == ?", (5,))
assert build_conditions(
**{
"a": 5,
"b": 4,
}
) == ("(a == ?) AND (b == ?)", (5, 4))
assert build_conditions(
**{
"$or": [
{"a": 5},
{"b": 4},
],
"c": 3,
}
) == ("((a == ?) OR (b == ?)) AND (c == ?)", (5, 4, 3))
assert build_conditions(
**{
"a": {"$ge": 5},
}
) == ("a >= ?", (5,))
assert build_conditions(
**{
"a": {"$in": [1, 2]},
}
) == ("a in (?, ?)", (1, 2))


def test_malformed_conditions():
Expand Down

0 comments on commit c8e8ecc

Please sign in to comment.