File: test_test_utils.py

package info (click to toggle)
python-ratelimitqueue 0.2.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180 kB
  • sloc: python: 463; makefile: 15
file content (19 lines) | stat: -rw-r--r-- 544 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Tests for tests/utils.py"""
from . import utils


class TestAlmost:
    def test_above_threshold(self):
        assert utils.almost(0, 1, 0) is False

    def test_below_threshold(self):
        assert utils.almost(0, 0, 1) is True

    def test_b_less_than_a(self):
        assert utils.almost(1, 0) is False
        assert utils.almost(1, 0.99, 0.1) is True

    def test_negative_threshold(self):
        assert utils.almost(0, 0, -1) is False
        assert utils.almost(1, 0, -1) is False
        assert utils.almost(0, 1, -1) is False