datetime module¶
- class badidatetime.tests.test_datetime.NoneTimeZone[source]¶
Bases:
tzinfoCreates a Timezone which defaults to None for the utcoffset, tzname, and dst methods.
- class badidatetime.tests.test_datetime.TestBadiDatetimeFunctions(name)[source]¶
Bases:
TestCase- _classSetupFailed = False¶
- _class_cleanups = []¶
- classmethod setUpClass()[source]¶
Hook method for setting up class fixture before running tests in the class.
- test__check_tzinfo_arg()[source]¶
Test that the _check_tzinfo_arg function returns the correct result.
- test__check_tzname()[source]¶
Test that the _check_tzname function raises a TypeError is the name argument is not None or a string.
- test__divide_and_round()[source]¶
Test that the _divide_and_round function returns the correct result.
- class badidatetime.tests.test_datetime.TestBadiDatetime_TZWithCoords(name)[source]¶
Bases:
TestCase- _classSetupFailed = False¶
- _class_cleanups = []¶
- class badidatetime.tests.test_datetime.TestBadiDatetime__IsoCalendarDate(name)[source]¶
Bases:
TestCase- _classSetupFailed = False¶
- _class_cleanups = []¶
- class badidatetime.tests.test_datetime.TestBadiDatetime__module__(name)[source]¶
Bases:
TestCaseTest that all classes that are defined in the datetime.py module have their internal __module__ changed to badidatetime.
- _classSetupFailed = False¶
- _class_cleanups = []¶
- class badidatetime.tests.test_datetime.TestBadiDatetime_date(name)[source]¶
Bases:
TestCase- _classSetupFailed = False¶
- _class_cleanups = []¶
- classmethod setUpClass()[source]¶
Hook method for setting up class fixture before running tests in the class.
- test___ge__()[source]¶
Test that the __ge__ method returns True if greater than or equal and False if not greater than or equal.
- test___gt__()[source]¶
Test that the __gt__ method returns True if greater than and False if not greater than.
- test___hash__()[source]¶
Test that the __hash__ method returns a valid hash for both short and long form dates.
- test___le__()[source]¶
Test that the __le__ method returns True if less than or equal and False if not less than or equal.
- test___lt__()[source]¶
Test that the __lt__ method returns True if less than and False if not less than.
- test___new__()[source]¶
Test that the __new__ method creates an instance from both a pickle object and a normal instantiation.
- test___reduce__()[source]¶
Test that the __reduce__ method works for both short and long form Badi dates.
- test___str__()[source]¶
Test that the __str__ method returns the ISO formated version of the date represented by the class object.
- test___sub__()[source]¶
Test that the __sub__ method returns the correct results of a timedelta object subtracted from a date object.
- test__cmp()[source]¶
Test that the _cmp method returns 1 if the two dates are equal, +1 if the current date is greater than the test date, and -1 if the inverse.
- test__is_pickle_data()[source]¶
Test that the _is_pickle_data classmethod returns the correct results depending on the incoming data.
- test__short_from_long_form()[source]¶
Test that the _short_from_long_form method returns the short form Badi date.
- test_ctime()[source]¶
Test that the ctime method creates a string indicating the date.
All days before 1752-09-14 in the Gregorian Calendar will seem wrong when compaired to the Badi Calendar in UK and the US. This is when The Gregorian Calendar was adopted and compinsated 11 days.
- test_fromisocalendar()[source]¶
Test that the fromisocalendar class method creates a date instance from an ISO calendar date.
- test_fromisoformat()[source]¶
Test that the fromisoformat class method creates a date instance from an ISO formatted string.
- test_fromordinal()[source]¶
Test that the fromordinal class method creates a date instance from a date ordinal number.
local coords (35.5894, -78.7792, -5.0)
- test_fromtimestamp_local()[source]¶
Test that the fromtimestamp class method creates an instance of date from a POSIX timestamp for local time.
- test_fromtimestamp_tehran()[source]¶
Test that the fromtimestamp class method creates an instance of date from a POSIX timestamp for Tehran time.
- test_fromtimestamp_utc()[source]¶
Test that the fromtimestamp class method creates an instance of date from a POSIX timestamp for UTC time.
- test_is_short()[source]¶
Test that the is_short property properly indicates if the Badi date is in the short or long form.
- test_isoformat()[source]¶
Test that the isoformat method return the ISO formated version of the date represented by this class.
- test_replace()[source]¶
Test that the replace method returns a new date object with the replaced values.
- class badidatetime.tests.test_datetime.TestBadiDatetime_datetime(name)[source]¶
Bases:
TestCase- _classSetupFailed = False¶
- _class_cleanups = []¶
- classmethod setUpClass()[source]¶
Hook method for setting up class fixture before running tests in the class.
- test___ge__()[source]¶
Test that the __ge__ method returns True if greater than or equal and False if not greater than or equal.
- test___gt__()[source]¶
Test that the __gt__ method returns True if greater than and False if not greater than.
- test___hash__()[source]¶
Test that the __hash__ method returns a valid hash for both short and long form datetimes.
- test___le__()[source]¶
Test that the __le__ method returns True if less than or equal and False if not less than or equal.
- test___lt__()[source]¶
Test that the __lt__ method returns True if less than and False if not less than.
- test___new__()[source]¶
Test that the __new__ method creates an instance from both a pickle object and a normal instantiation.
- test___reduce_ex__()[source]¶
Test that the __reduce_ex__ method creates the correct pickle value for protocol 3.
- test___sub__()[source]¶
Test that the __sub__ method returns the correct results of a timedelta object subtracted from a datetime object.
- test__cmp()[source]¶
Test that the _cmp method returns 1 if the two dates are equal, +1 if the current date is greater than the test date, and -1 if the inverse.
- test__dt_str_conversion()[source]¶
Test that the _dt_str_conversion method returns a string of the object.
- test__fromtimestamp_gmt()[source]¶
Test that the _fromtimestamp classmethod creates an instance of datetime.
Note
The tests marked ‘Latitude and Longitude dependent’ will break if datetime.LOCAL_COORD is not patched when run in a different locale.
- test__fromtimestamp_local()[source]¶
Test that the _fromtimestamp classmethod creates an instance of datetime.
Note
The tests marked ‘Latitude and Longitude dependent’ will break if datetime.LOCAL_COORD is not patched when run in a different locale.
- test__is_pickle_data()[source]¶
Test that the _is_pickle_data classmethod returns the correct results depending on the incoming data.
- test__mktime_gmt()[source]¶
Test that the _mktime method finds the POSIX time in seconds for local GMT time. All tests below will only work with GMT set at the local time set in the above patch. https://www.epochconverter.com/timezones https://www.suntoday.org/sunrise-sunset/
- test__mktime_local()[source]¶
Test that the _mktime method finds the POSIX time in seconds for local time EST. All tests below will only work with the local time set in the above patch.
- test__mktime_tehran()[source]¶
Test that the _mktime method finds the POSIX time in seconds for local time in Terhan. All tests below will only work with Terhan set as the local time set in the above patch. https://www.epochconverter.io/timezones-converter
- test_astimezone()[source]¶
Test that the astimezone method returns a datetime object with a replaced the timezone tzinfo object.
- test_combine()[source]¶
Test that the combine classmethod creates an instance of datetime from an instance of a date and time object.
- test_ctime()[source]¶
Test that the ctime method creates a string indicating the date and time.
All days before 1752-09-14 in the Gregorian Calendar will seem wrong when compaired to the Badi Calendar in UK and the US. This is when The Gregorian Calendar was adopted and compinsated 11 days.
- test_date()[source]¶
Test that thedate method returns a date object with the same date as the originating datetime object.
- test_dst()[source]¶
Test that the dst method returns the daylight savings time associated with the datetime object.
- test_fromisoformat()[source]¶
Test that the fromisoformat classmethod creates an instance of datetime.
- test_fromtimestamp()[source]¶
Test that the fromtimestamp classmethod creates a correct instance of datetime with a -5.0 time zone.
Note
The tests marked ‘Latitude and Longitude dependent’ will break if datetime.LOCAL_COORD is not patched when run in a different locale.
- test_now()[source]¶
Test that the now classmethod creates an instance of datetime. It is not possible to test actual dates and time as they will change every second.
- test_replace()[source]¶
Test that the replace method a new datetime object with the replaced values.
- test_strptime()[source]¶
Test that the strptime method parses a date from a string and returns a datetime class object.
- test_time()[source]¶
Test that the time method a time object with the same time as the originating datetime object.
- test_timestamp()[source]¶
Test that the timestamp method returns either the POSIX time for local or for the timezone provided.
https://www.unixtimestamp.com https://www.epochconverter.com
- test_timetuple()[source]¶
Test that the timetuple method returns either a short or long form timetuple.
- test_timetz()[source]¶
Test that the timetz method a time object with the same time and tzinfo as the originating datetime object.
- test_tzname()[source]¶
Test that the tzname method returns the timezone associated with the datetime object.
- class badidatetime.tests.test_datetime.TestBadiDatetime_time(name)[source]¶
Bases:
TestCase- _classSetupFailed = False¶
- _class_cleanups = []¶
- classmethod setUpClass()[source]¶
Hook method for setting up class fixture before running tests in the class.
- test___ge__()[source]¶
Test that the __ge__ method returns True if greater than or equal and False if not greater than or equal.
- test___gt__()[source]¶
Test that the __gt__ method returns True if greater than and False if not greater than.
- test___le__()[source]¶
Test that the __le__ method returns True if less than or equal and False if not less than or equal.
- test___lt__()[source]¶
Test that the __lt__ method returns True if less than and False if not less than.
- test___new__()[source]¶
Test that the __new__ method creates an instance from both a pickle object and a normal instantiation.
- test___reduce_ex__()[source]¶
Test that the __reduce_ex__ method creates the correct pickle value for protocol 3.
- test__cmp()[source]¶
Test that the _cmp method returns 1 if the two times are equal, +1 if the current time is greater than the test time, and -1 if the inverse.
- class badidatetime.tests.test_datetime.TestBadiDatetime_timezone(name)[source]¶
Bases:
TestCase- _classSetupFailed = False¶
- _class_cleanups = []¶
- test___getinitargs__()[source]¶
Test that the __getinitargs__ method returns the arguments that the timezone class was instantiated with.
- test___new__()[source]¶
Test that the __new__ method creates an instance from both a pickle object and a normal instantiation.
- test__name_from_offset()[source]¶
Test that the _name_from_offset returns a string indicating the UTC offset.