fix build_duration_func() (#2533)

for extractors with request_interval_min > 0
This commit is contained in:
Mike Fährmann
2022-04-27 20:28:14 +02:00
parent afde76269c
commit ca3a364db7
2 changed files with 8 additions and 2 deletions

View File

@@ -385,8 +385,6 @@ class TestOther(unittest.TestCase):
expr()
def test_build_duration_func(self, f=util.build_duration_func):
for v in (0, 0.0, "", None, (), []):
self.assertIsNone(f(v))
def test_single(df, v):
for _ in range(10):
@@ -398,6 +396,12 @@ class TestOther(unittest.TestCase):
self.assertGreaterEqual(v, lower)
self.assertLessEqual(v, upper)
for v in (0, 0.0, "", None, (), []):
self.assertIsNone(f(v))
for v in (0, 0.0, "", None, (), []):
test_single(f(v, 1.0), 1.0)
test_single(f(3), 3)
test_single(f(3.0), 3.0)
test_single(f("3"), 3)