def test_subfmts_regex():
 class TimeLongYear(TimeString, ):
  name = 'longyear'
  subfmts = (('date', '(?P<year>[+-]\\d{5})-%m-%d', '{year:+06d}-{mon:02d}-{day:02d}'),)
 t = Time('+02000-02-03', format='longyear')
 assert (t.value == '+02000-02-03')
 assert (t.jd == Time('2000-02-03').jd)

def test_subfmts_regex ( ) : class TimeLongYear ( TimeString , ) : name = 'longyear' subfmts = ( ( 'date' , '(?P<year>[+-]\\d{5})-%m-%d' , '{year:+06d}-{mon:02d}-{day:02d}' ) , ) t = Time ( '+02000-02-03' , format = 'longyear' ) assert ( t . value == '+02000-02-03' ) assert ( t . jd == Time ( '2000-02-03' ) . jd )
test having a custom subfmts with a regular expression .