def do_ls(self, arg):
        """\
        List events of the day.
        """
        json_root = self.storage_manager.get_json_object()
        target_year = str(self.year)
        target_month = str(self.month)
        target_day = str(self.day)
        try:
            event_list = json_root[target_year][target_month][target_day]
            print "These are the events of " + Globals.MONTH_DICT[
                self.month] + " " + DateStringParser.get_ordinal(
                    self.day) + ", " + target_year + ":"
            for i, val in enumerate(event_list):
                print "        - " + val

        except Exception:
            print "There are no events on this day."
    def do_ls(self, arg):
        """\
        List events of the day.
        """
        json_root = self.storage_manager.get_json_object()
        target_year = str(self.year)
        target_month = str(self.month)
        target_day = str(self.day)
        try:
            event_list = json_root[target_year][target_month][target_day]
            print "These are the events of " + Globals.MONTH_DICT[self.month] + " " + DateStringParser.get_ordinal(self.day) + ", " + target_year + ":"
            for i, val in enumerate(event_list):
                print "        - " + val

        except Exception:
            print "There are no events on this day."
Esempio n. 3
0
 def test_get_ordinal(self):
     self.assertEqual(DateStringParser.get_ordinal(1), "1st")
     self.assertEqual(DateStringParser.get_ordinal(2), "2nd")
     self.assertEqual(DateStringParser.get_ordinal(3), "3rd")
     self.assertEqual(DateStringParser.get_ordinal(4), "4th")
Esempio n. 4
0
 def test_get_ordinal(self):
     self.assertEqual(DateStringParser.get_ordinal(1), "1st")
     self.assertEqual(DateStringParser.get_ordinal(2), "2nd")
     self.assertEqual(DateStringParser.get_ordinal(3), "3rd")
     self.assertEqual(DateStringParser.get_ordinal(4), "4th")