@@ -203,20 +203,39 @@ def test_rfc3339_wo_nanos():
203
203
stamp = datetime_helpers .DatetimeWithNanoseconds (2016 , 12 , 20 , 21 , 13 , 47 , 123456 )
204
204
assert stamp .rfc3339 () == "2016-12-20T21:13:47.123456Z"
205
205
206
+ @staticmethod
207
+ def test_rfc3339_wo_nanos_w_leading_zero ():
208
+ stamp = datetime_helpers .DatetimeWithNanoseconds (2016 , 12 , 20 , 21 , 13 , 47 , 1234 )
209
+ assert stamp .rfc3339 () == "2016-12-20T21:13:47.001234Z"
210
+
206
211
@staticmethod
207
212
def test_rfc3339_w_nanos ():
208
213
stamp = datetime_helpers .DatetimeWithNanoseconds (
209
214
2016 , 12 , 20 , 21 , 13 , 47 , nanosecond = 123456789
210
215
)
211
216
assert stamp .rfc3339 () == "2016-12-20T21:13:47.123456789Z"
212
217
218
+ @staticmethod
219
+ def test_rfc3339_w_nanos_w_leading_zero ():
220
+ stamp = datetime_helpers .DatetimeWithNanoseconds (
221
+ 2016 , 12 , 20 , 21 , 13 , 47 , nanosecond = 1234567
222
+ )
223
+ assert stamp .rfc3339 () == "2016-12-20T21:13:47.001234567Z"
224
+
213
225
@staticmethod
214
226
def test_rfc3339_w_nanos_no_trailing_zeroes ():
215
227
stamp = datetime_helpers .DatetimeWithNanoseconds (
216
228
2016 , 12 , 20 , 21 , 13 , 47 , nanosecond = 100000000
217
229
)
218
230
assert stamp .rfc3339 () == "2016-12-20T21:13:47.1Z"
219
231
232
+ @staticmethod
233
+ def test_rfc3339_w_nanos_w_leading_zero_and_no_trailing_zeros ():
234
+ stamp = datetime_helpers .DatetimeWithNanoseconds (
235
+ 2016 , 12 , 20 , 21 , 13 , 47 , nanosecond = 1234500
236
+ )
237
+ assert stamp .rfc3339 () == "2016-12-20T21:13:47.0012345Z"
238
+
220
239
@staticmethod
221
240
def test_from_rfc3339_w_invalid ():
222
241
stamp = "2016-12-20T21:13:47"
0 commit comments