Skip to content

Commit c6f5617

Browse files
committed
[test-property] Add Tests for Wrong Value Formats
1 parent 82ed96c commit c6f5617

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/test_property.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import unittest
22

3+
import datetime
4+
35
from odml import Property, Section, Document, DType
46
from odml.property import BaseProperty
57
from odml.section import BaseSection
@@ -115,6 +117,19 @@ def test_value(self):
115117
self.assertEqual(p5.value, [0])
116118
self.assertEqual(p5.values, [0])
117119

120+
with self.assertRaises(ValueError):
121+
Property(name="dateprop", dtype=DType.time, value=['20190707'])
122+
123+
with self.assertRaises(ValueError):
124+
Property(name="timeprop", dtype=DType.time, value=['11.11.11'])
125+
126+
with self.assertRaises(ValueError):
127+
Property(name="datetimeprop", dtype=DType.datetime, value=['20190707'])
128+
129+
with self.assertRaises(ValueError):
130+
Property(name="intprop", dtype=DType.int, value=[2, "Hello!", 4])
131+
132+
118133
def test_value_append(self):
119134
# Test append w/o Property value or dtype
120135
prop = Property(name="append")

0 commit comments

Comments
 (0)