def test_timestamp(self): t = Timestamp('%a, %d %b %Y %H:%M:%S') # check valid timestamp t.check('Sat, 21 Aug 2010 22:31:20') # check bad timestamp with self.assertRaises(ValueError) as cm: t.check('Sat, 21 Aug 2010') self.assertIn('does not match format', cm.exception.args[0])
def _make_namespace_with_many_structs(): # type: (...) -> ApiNamespace ns = ApiNamespace('ns_with_many_structs') struct1 = Struct(name='Struct1', namespace=ns, token=None) struct1.set_attributes(None, [StructField('f1', Boolean(), None, None)]) ns.add_data_type(struct1) struct2 = Struct(name='Struct2', namespace=ns, token=None) struct2.set_attributes(doc=None, fields=[ StructField('f2', List(UInt64()), None, None), StructField('f3', Timestamp(ISO_8601_FORMAT), None, None) ]) ns.add_data_type(struct2) return ns