@@ -203,20 +203,39 @@ def test_rfc3339_wo_nanos():
203203 stamp = datetime_helpers .DatetimeWithNanoseconds (2016 , 12 , 20 , 21 , 13 , 47 , 123456 )
204204 assert stamp .rfc3339 () == "2016-12-20T21:13:47.123456Z"
205205
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+
206211 @staticmethod
207212 def test_rfc3339_w_nanos ():
208213 stamp = datetime_helpers .DatetimeWithNanoseconds (
209214 2016 , 12 , 20 , 21 , 13 , 47 , nanosecond = 123456789
210215 )
211216 assert stamp .rfc3339 () == "2016-12-20T21:13:47.123456789Z"
212217
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+
213225 @staticmethod
214226 def test_rfc3339_w_nanos_no_trailing_zeroes ():
215227 stamp = datetime_helpers .DatetimeWithNanoseconds (
216228 2016 , 12 , 20 , 21 , 13 , 47 , nanosecond = 100000000
217229 )
218230 assert stamp .rfc3339 () == "2016-12-20T21:13:47.1Z"
219231
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+
220239 @staticmethod
221240 def test_from_rfc3339_w_invalid ():
222241 stamp = "2016-12-20T21:13:47"
0 commit comments