lpschedule-generator

libreplanet schedule generator - ricketyspace.net/lpschedule-generator
git clone git://git.ricketyspace.net/lpschedule-generator.git
Log | Files | Refs

commit 8bb24f30c0aba9b72567dd000fff6004b67abe43
parent 9f909aea468313e74716c5de37fd7cbd00de96fa
Author: rsiddharth <rsd@gnu.org>
Date:   Sun, 26 May 2019 09:45:56 -0400

lps_gen.py: Update LPiCal.

* lps_gen.py (LPiCal.__init__): Use format function for formatted
  string.
* tests/test_lps_gen.py (TestLPiCal.test_init): New test.

Diffstat:
lps_gen.py | 2+-
tests/test_lps_gen.py | 11+++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lps_gen.py b/lps_gen.py @@ -109,7 +109,7 @@ class LPiCal(object): self.cal = Calendar() self.cal.add('prodid', '-//lpschedule generator//mxm.dk//') self.cal.add('version', '2.0') - self.cal.add('x-wr-calname', 'LibrePlanet %s' % self.lp_year) + self.cal.add('x-wr-calname', 'LibrePlanet {}'.format(self.lp_year)) # RFC 2445 requires DTSTAMP to be in UTC. DTSTAMP is used in # VEVENT (Event object, see `add_event` method). diff --git a/tests/test_lps_gen.py b/tests/test_lps_gen.py @@ -135,6 +135,17 @@ class TestLPiCal(object): self.lp_ical = LPiCal(self.lps_dict, '2019') + def test_init(self): + """Testing LPiCal.__init__. + """ + lp_ical = LPiCal(self.lps_dict, '2019') + + assert_equal(lp_ical.lp_year, '2019') + assert_equal(lp_ical.cal.get('x-wr-calname'), + 'LibrePlanet 2019') + assert_equal(lp_ical.ucounter, 0) + + def test_gen_uid(self): """Testing LPiCal.gen_uid. """