Package trac :: Package timeline :: Package tests :: Module wikisyntax

Source Code for Module trac.timeline.tests.wikisyntax

 1  # -*- coding: utf-8 -*- 
 2  # 
 3  # Copyright (C) 2013-2020 Edgewall Software 
 4  # All rights reserved. 
 5  # 
 6  # This software is licensed as described in the file COPYING, which 
 7  # you should have received as part of this distribution. The terms 
 8  # are also available at https://trac.edgewall.org/wiki/TracLicense. 
 9  # 
10  # This software consists of voluntary contributions made by many 
11  # individuals. For the exact contribution history, see the revision 
12  # history and logs, available at https://trac.edgewall.org/log/. 
13   
14  import time 
15  import unittest 
16   
17  from trac.timeline.web_ui import TimelineModule 
18  from trac.wiki.tests import formatter 
19   
20  TIMELINE_TEST_CASES = u""" 
21  ============================== timeline: link resolver 
22  timeline:2008-01-29 
23  timeline:2008-01-29T15:48 
24  timeline:2008-01-29T15:48Z 
25  timeline:2008-01-29T16:48+01 
26  timeline:2008-01-0A 
27  timeline:@datestr_libc@ 
28  ------------------------------ 
29  <p> 
30  <a class="timeline" href="/timeline?from=2008-01-29T00%3A00%3A00Z" title="See timeline at 2008-01-29T00:00:00Z">timeline:2008-01-29</a> 
31  <a class="timeline" href="/timeline?from=2008-01-29T15%3A48%3A00Z&amp;precision=minutes" title="See timeline at 2008-01-29T15:48:00Z">timeline:2008-01-29T15:48</a> 
32  <a class="timeline" href="/timeline?from=2008-01-29T15%3A48%3A00Z&amp;precision=minutes" title="See timeline at 2008-01-29T15:48:00Z">timeline:2008-01-29T15:48Z</a> 
33  <a class="timeline" href="/timeline?from=2008-01-29T15%3A48%3A00Z&amp;precision=seconds" title="See timeline at 2008-01-29T15:48:00Z">timeline:2008-01-29T16:48+01</a> 
34  <a class="timeline missing" title="&#34;2008-01-0A&#34; is an invalid date, or the date format is not known. Try &#34;YYYY-MM-DDThh:mm:ss±hh:mm&#34; instead.">timeline:2008-01-0A</a> 
35  <a class="timeline missing" title="&#34;@datestr_libc@&#34; is an invalid date, or the date format is not known. Try &#34;YYYY-MM-DDThh:mm:ss±hh:mm&#34; instead.">timeline:@datestr_libc@</a> 
36  </p> 
37  ------------------------------ 
38  """ 
39   
40   
41 -def suite():
42 suite = unittest.TestSuite() 43 datestr_libc = time.strftime('%x', (2013, 10, 24, 0, 0, 0, 0, 0, -1)) 44 suite.addTest(formatter.suite(TIMELINE_TEST_CASES.replace('@datestr_libc@', 45 datestr_libc), 46 file=__file__)) 47 return suite
48 49 if __name__ == '__main__': 50 unittest.main(defaultTest='suite') 51