TimedateUtils

class badidatetime.tests.test_timedateutils.TestTimeDateUtils(name)[source]

Bases: TestCase

Notes on running these tests. If you live outside of the USA you may need to install the USA local info on your computer or some tests will fail. There is no way to test for changing local information when most tests are hard coded.

_classSetupFailed = False
_class_cleanups = []
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test__build_struct_time()[source]

Test that the _build_struct_time correctly builds a timetuple object.

test__check_date_fields()[source]

Test that the _check_date_fields function correctly raises assertion exceptions.

A more complete test is in badidatetime/tests/test_badi_calendar.py.

test__check_format()[source]

Test that the _check_format method does not raise an exception with an invalid format.

test__check_time_fields()[source]

Test that the _check_time_fields function correctly raises assertion exceptions.

test__checktm()[source]

Test that the _checktm method does not raise an exception with an invalid tupple type.

test__day_of_week()[source]

Test that the _day_of_week function returns the correct day of the week (0 - 6) for a given year, month, and day.

All days before 1752-09-14 (-91, 10, 8, 5, 46, 17.1264) in the Gregorian Calendar will seem wrong when compared to the Badi Calendar in UK and the US. This is when the Gregorian Calendar was adopted and compensated 11 days.

test__days_before_month()[source]

Test that the _days_before_month function returns the correct number of days in the year proceedings the first day in the correct month.

test__days_before_year()[source]

Test that the _days_before_year function returns the correct number of days before the specified year.

test__find_midday()[source]

Test that the _find_midday method returns the correct midday fraction of the day with either long or short form dates.

test__find_time_order()[source]

Test that the _find_time_order method parses the time format properly.

test__get_year()[source]

Test that the _get_year returns the year converted from a long form date or the year from a short date.

test__isoweek1jalal()[source]

Test that the _isoweek1jalal function returns the ordinal day number of the first week with more than 3 days in it.

This can be checked with the Python standard datetime.datetime(year, month, day).toordinal() method.

test__isoweek_to_badi()[source]

Test that the _isoweek_to_badi function returns the year, month, and day for the beginning of the week either before or after depending on what day in the week the day falls.

test__ord2ymd()[source]

Test that the _ord2ymd function returns the year, month, and day from the Badi year -1842.

test__order_format()[source]

Test that the _order_format returns a correctly parsed date or time format.

test__parse_isoformat_date()[source]

Test that the _parse_isoformat_date function parses the date correctly from ISO standard formats.

test__parse_isoformat_date_time_timezone()[source]

Test that the _parse_isoformat_date_time_timezone function returns a parsed date and time ISO string.

test__parse_isoformat_time()[source]

Test that the _parse_isoformat_time function parses the time correctly from ISO standard formats.

test__parse_isoformat_timezone()[source]

Test that the _parse_isoformat_timezone

test__wrap_strftime()[source]

Test that the _wrap_strftime function returns a formatted time string.

test__year_week_day()[source]

Test that the _year_week_day return the year, week, and day of the week.

test__ymd2ord()[source]

Test that the _ymd2ord function returns the correct number of days since Badi year -1842 including the current day.

test_am()[source]

Test that the am property is set correctly

test_date_format()[source]

Test that the date_format property is set correctly

test_locale()[source]

Test that the locale property is set correctly.

test_pm()[source]

Test that the pm property is set correctly

test_strftime(mock_property)[source]

Test that the strftime method returns the correct string.

test_time_format()[source]

Test that the time_format property is set correctly