def test_strptime_year_special_case(self): assert nepali_datetime.datetime.strptime( "89", "%y") == nepali_datetime.datetime(2089, 1, 1) assert nepali_datetime.datetime.strptime( "90", "%y") == nepali_datetime.datetime(1990, 1, 1) assert nepali_datetime.datetime.strptime( "00", "%y") == nepali_datetime.datetime(2000, 1, 1)
def test_init(self): dt = nepali_datetime.datetime(2033, 2, 10, 10, 5, 30, 123456) assert dt.year == 2033 assert dt.month == 2 assert dt.day == 10 assert dt.hour == 10 assert dt.minute == 5 assert dt.second == 30 assert dt.microsecond == 123456
def test_timestamp(self): dt = nepali_datetime.datetime(2078, 2, 23) ad_dt = datetime.datetime(2021, 6, 6, tzinfo=nepali_datetime.UTC0545()) assert dt.timestamp() == ad_dt.timestamp()
def test_strptime_datetime(self): assert nepali_datetime.datetime.strptime( "Asar 23 2025 10:00:00", "%B %d %Y %H:%M:%S") == nepali_datetime.datetime( 2025, 3, 23, 10, 0, 0)
def test_strftime_datetime(self): dt = nepali_datetime.datetime(2052, 10, 29, 15, 22, 50, 2222) assert dt.strftime("%m/%d/%Y %I:%M:%S.%f %p %a %A" ) == "10/29/2052 03:22:50.002222 PM Mon Monday"