Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 97f1465

Browse files
author
Aistis Jokubauskas
committed
Add tests to cover missing lines for _convert_timestamp
1 parent b0517c7 commit 97f1465

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

influxdb/tests/test_line_protocol.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import unittest
99

1010
from influxdb import line_protocol
11+
from influxdb.line_protocol import _convert_timestamp
1112

1213

1314
class TestLineProtocol(unittest.TestCase):
@@ -88,3 +89,14 @@ def test_quote_literal(self):
8889
line_protocol.quote_literal(r"""\foo ' bar " Örf"""),
8990
r"""'\\foo \' bar " Örf'"""
9091
)
92+
93+
94+
class Test_convert_timestamp(unittest.TestCase):
95+
96+
def test_if_raises_value_error_when_not_supported(self):
97+
with self.assertRaises(ValueError):
98+
_convert_timestamp(object())
99+
100+
def test_if_returs_unmodified_integral_values(self):
101+
self.assertEqual(_convert_timestamp(5), 5)
102+
self.assertEqual(_convert_timestamp(-2), -2)

0 commit comments

Comments
 (0)