async def g2j(y: int, m: int, d: int, request: Request, iso: bool = False): arg_check(("y", "m", "d", "iso"), request.query_params.keys()) if y not in range(*g_year_range): raise HTTPException(status_code=404) try: g = date(year=y, month=m, day=d) j = JalaliDate(g) if iso: return {"j": j.isoformat()} return { "j": { "y": j.year, "m": j.month, "d": j.day }, } except Exception: raise HTTPException(status_code=404)
def test_iso_format(self): jdate = JalaliDate(self.leap_year, 12, 23) self.assertEqual(jdate.isoformat(), '%s-12-23' % self.leap_year)
def test_str(self): d1 = JalaliDate(1361, 6, 15) self.assertEqual(d1.__str__(), d1.isoformat())
def test_str(self): d1 = JalaliDate(1361, 6, 15) self.assertEqual( d1.__str__(), d1.isoformat() )