pyruse/tests/filter_greaterOrEquals.py

27 lines
931 B
Python
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# pyruse is intended as a replacement to both fail2ban and epylog
# Copyright © 20172018 Y. Gablin
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
from pyruse.filters.filter_greaterOrEquals import Filter
def whenGreaterPosIntThenTrue():
assert Filter({"field": "v", "value": 2}).filter({"v": 3})
def whenGreaterNegFloatThenTrue():
assert Filter({"field": "v", "value": -2.1}).filter({"v": -1.9})
def whenEqualSameTypeThenTrue():
assert Filter({"field": "v", "value": 2}).filter({"v": 2})
def whenEqualDiffTypeThenTrue():
assert Filter({"field": "v", "value": 2.0}).filter({"v": 2})
def whenLowerThenFalse():
assert not Filter({"field": "v", "value": 2}).filter({"v": 0})
def unitTests():
whenGreaterPosIntThenTrue()
whenGreaterNegFloatThenTrue()
whenEqualSameTypeThenTrue()
whenEqualDiffTypeThenTrue()
whenLowerThenFalse()