コード例 #1
0
ファイル: dates.py プロジェクト: rohieb/stratum0-calendar
	def setUp(self):
		self.datetime1 = cg.tz.localize(datetime.datetime(2010, 4, 1, 12, 22))
		self.datetime2 = cg.tz.localize(datetime.datetime(2020, 4, 1, 12, 22))

		self.sd1 = cg.SingleDate("name", "cat", [20, 8, 2014])
		self.sd2 = cg.SingleDate("name", "cat", [21, 8, 2014])
		self.sd3 = cg.SingleDate("name", "cat", [21, 8, 2014])

		self.sdt1 = cg.SingleDateTime("name", "cat", [22, 8, 2014, 12, 00])
		self.sdt2 = cg.SingleDateTime("name", "cat", [23, 8, 2014, 14, 00])

		self.sdt3 = cg.SingleDateTime("name", "cat", [20, 8, 2014, 12, 00])
		self.sdt4 = cg.SingleDateTime("a-name", "cat", [20, 8, 2014, 15, 00])
		self.sdt5 = cg.SingleDateTime("b-name", "cat", [20, 8, 2014, 15, 00])

		self.sdtr1 = cg.SingleDateTimeRange("name", "cat", [24, 8, 2014, 12, 00, 14, 00])
		self.sdtr2 = cg.SingleDateTimeRange("name", "cat", [24, 9, 2014, 13, 00, 15, 00])

		self.sdtr3 = cg.SingleDateTimeRange("name", "cat", [24, 8, 2014, 12, 00, 14, 00])
		self.sdtr4 = cg.SingleDateTimeRange("a-name", "cat", [24, 8, 2014, 12, 00, 15, 00])
		self.sdtr5 = cg.SingleDateTimeRange("b-name", "cat", [24, 8, 2014, 12, 00, 15, 00])

		self.dr1 = cg.DateRange("name", "cat", [20, 8, 2014, 21, 8, 2014])
		self.dr2 = cg.DateRange("name", "cat", [20, 9, 2014, 21, 9, 2014])

		self.dtr1 = cg.DateTimeRange("name", "cat", [20, 8, 2014, 12, 00, 21, 8, 2014, 14, 00])
		self.dtr2 = cg.DateTimeRange("name", "cat", [20, 9, 2014, 13, 00, 21, 9, 2014, 15, 00])
コード例 #2
0
ファイル: parser.py プロジェクト: rohieb/stratum0-calendar
	def test_firstUrl(self):
		url_date = cg.SingleDate("abc [https://stratum0.net/ title] [[test_url|test_title]]", "cat", [20, 9, 2014])
		self.assertEqual(url_date.getURL(), "https://stratum0.net/")
		self.assertEqual(url_date.getPlainName(), "abc title test_title")

		url_date2 = cg.SingleDate("abc [[test_url|test_title]] [https://stratum0.net/ title]", "cat", [20, 9, 2014])
		self.assertEqual(url_date2.getURL(), "https://stratum0.org/wiki/test_url")
		self.assertEqual(url_date2.getPlainName(), "abc test_title title")
コード例 #3
0
ファイル: parser.py プロジェクト: rohieb/stratum0-calendar
	def test_internUmlautUrl(self):
		url_date = cg.SingleDate(u"[[test_ürl]]", "cat", [20, 9, 2014])
		self.assertEqual(url_date.getURL(), u"https://stratum0.org/wiki/test_%c3%bcrl")
		self.assertEqual(url_date.getPlainName(), u"test_ürl")

		url_date2 = cg.SingleDate(u"[[test_ürlä]]", "cat", [20, 9, 2014])
		self.assertEqual(url_date2.getURL(), u"https://stratum0.org/wiki/test_%c3%bcrl%c3%a4")
		self.assertEqual(url_date2.getPlainName(), u"test_ürlä")
コード例 #4
0
 def setUp(self):
     self.tempdir = tempfile.gettempdir()
     self.json_path = os.path.join(self.tempdir, "events.json")
     self.css_path = os.path.join(self.tempdir, "events.css")
     self.ics_path = os.path.join(self.tempdir, "events.ics")
     self.events = [
         cg.SingleDate("Event", "cat", (10, 10, 2014)),
         cg.SingleDateTime("Event 2", "cat2", (10, 12, 2014, 12, 00)),
         cg.SingleDateTimeRange("Event 3", "cat2",
                                (10, 12, 2014, 12, 00, 14, 00)),
         cg.DateRange("Event 4", "cat2", (10, 12, 2014, 4, 1, 2015)),
         cg.DateTimeRange("Event 5", "cat1",
                          (10, 12, 2014, 12, 00, 12, 12, 2014, 13, 00)),
         cg.WeekdayTimeGenerator("Event 6b", "cat5e", ("Mo", 13, 15),
                                 "12.12.2014 - 4.2.2015"),
         cg.WeekdayTimeRangeGenerator("Event 6b", "cat5e",
                                      ("Mo", 13, 15, 15, 45),
                                      "12.12.2014 - 4.2.2015"),
         cg.WeekdayTimeGenerator("Event 6", "cat5e", ("Mo", 13, 15),
                                 "12.12.2014 - 13.12.2014"),
         cg.SingleDate("Event -1", "cat", (6, 10, 2014)),
         cg.SingleDate("Event -1", "cat", (7, 10, 2014))
     ]
コード例 #5
0
ファイル: parser.py プロジェクト: rohieb/stratum0-calendar
	def test_double_bold(self):
		url_date = cg.SingleDate("abc '''def''' '''ghi'''", "cat", [20, 9, 2014])
		self.assertEqual(url_date.getPlainName(), "abc def ghi")
コード例 #6
0
ファイル: parser.py プロジェクト: rohieb/stratum0-calendar
	def test_emph(self):
		url_date = cg.SingleDate("abc ''def''", "cat", [20, 9, 2014])
		self.assertEqual(url_date.getPlainName(), "abc def")
コード例 #7
0
ファイル: parser.py プロジェクト: rohieb/stratum0-calendar
	def test_multiURL(self):
		url_date = cg.SingleDate("[https://events.ccc.de/congress/2014/ 31C3] ([https://events.ccc.de/congress/2014/wiki/Assembly:Stratum_0 Assembly])", "cat", [20, 9, 2014])
		self.assertEqual(url_date.getPlainName(), "31C3 (Assembly)")
		self.assertEqual(url_date.getURL(), "https://events.ccc.de/congress/2014/")
コード例 #8
0
ファイル: parser.py プロジェクト: rohieb/stratum0-calendar
	def test_externUrl(self):
		url_date = cg.SingleDate("abc [https://stratum0.net/ title]", "cat", [20, 9, 2014])
		self.assertEqual(url_date.getURL(), "https://stratum0.net/")
		self.assertEqual(url_date.getPlainName(), "abc title")
コード例 #9
0
ファイル: parser.py プロジェクト: rohieb/stratum0-calendar
	def test_internUrl(self):
		url_date = cg.SingleDate("abc [[test_url]]", "cat", [20, 9, 2014])
		self.assertEqual(url_date.getURL(), "https://stratum0.org/wiki/test_url")
		self.assertEqual(url_date.getPlainName(), "abc test_url")