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

Commit 35d3eb9

Browse files
author
Aistis Jokubauskas
committed
Add tests to cover missing lines for _convert_timestamp
1 parent 01b8440 commit 35d3eb9

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
@@ -10,6 +10,7 @@
1010
from pytz import UTC, timezone
1111

1212
from influxdb import line_protocol
13+
from influxdb.line_protocol import _convert_timestamp
1314

1415

1516
class TestLineProtocol(unittest.TestCase):
@@ -119,3 +120,14 @@ def test_quote_literal(self):
119120
line_protocol.quote_literal(r"""\foo ' bar " Örf"""),
120121
r"""'\\foo \' bar " Örf'"""
121122
)
123+
124+
125+
class Test_convert_timestamp(unittest.TestCase):
126+
127+
def test_if_raises_value_error_when_not_supported(self):
128+
with self.assertRaises(ValueError):
129+
_convert_timestamp(object())
130+
131+
def test_if_returs_unmodified_integral_values(self):
132+
self.assertEqual(_convert_timestamp(5), 5)
133+
self.assertEqual(_convert_timestamp(-2), -2)

0 commit comments

Comments
 (0)