async def _apod(ctx, _date: str = None): """ NASA Bot 'today/apod' command handling """ if not _date: _date = date.today().strftime('%m/%d/%Y') try: _date = convert_date(_date) except ValueError: await ctx.send('Sorry, I don\'t recognize that date format.') await get_apod_client().handle({'date': _date})
def test_convert_date_bad_sep(self): with self.assertRaises(ValueError): convert_date(BAD_DATE_FMT)
def test_convert_date_dash_sep(self): test_date_one = convert_date(DATE_ARG_DASH_FMT_ONE) test_date_two = convert_date(DATE_ARG_DASH_FMT_TWO) self.assertEqual(test_date_one, ISO_DATE_DASH_FMT) self.assertEqual(test_date_two, ISO_DATE_DASH_FMT)