tests.timestamp_tests module#

Tests for the Timestamp class.

class tests.time_tests.TestTimeFunctions(*args, **kwargs)[source]#

Bases: DisableSiteMixin, TestCase

Test functions in time module.

abstract_class = False#
test_parse_duration()[source]#

Test for extracting key and duration from shorthand notation.

test_str2timedelta()[source]#

Test for parsing the shorthand notation of durations.

class tests.time_tests.TestTimestamp(*args, **kwargs)[source]#

Bases: DisableSiteMixin, TestCase

Test Timestamp class comparisons.

abstract_class = False#
test_add_timedelta()[source]#

Test addin a timedelta to a Timestamp.

test_instantiate_from_instance()[source]#

Test passing instance to factory methods works.

test_iso_format()[source]#

Test conversion from and to ISO format.

test_iso_format_property()[source]#

Test iso format properties.

test_iso_format_with_sep()[source]#

Test conversion from and to ISO format with separator.

test_mediawiki_format()[source]#

Test conversion from and to Timestamp format.

test_results = {'INVALID': [['200902132331309999', None], ['2009-99-99 22:31:30.123456-01', None], ['1234567890.1234569999', None]], 'ISO8601': [['2009-02-13T23:31:30Z', '1234567890.000000'], ['2009-02-13T23:31:30', '1234567890.000000'], ['2009-02-13T23:31:30.123Z', '1234567890.123000'], ['2009-02-13T23:31:30.123', '1234567890.123000'], ['2009-02-13T23:31:30.123456Z', '1234567890.123456'], ['2009-02-13T23:31:30.123456', '1234567890.123456'], ['2009-02-13T23:31:30,123456Z', '1234567890.123456'], ['2009-02-13T23:31:30,123456', '1234567890.123456'], ['2009-02-14T00:31:30+0100', '1234567890.000000'], ['2009-02-13T22:31:30-0100', '1234567890.000000'], ['2009-02-14T00:31:30+01:00', '1234567890.000000'], ['2009-02-13T22:31:30-01:00', '1234567890.000000'], ['2009-02-13T23:41:30+00:10', '1234567890.000000'], ['2009-02-13T23:21:30-00:10', '1234567890.000000'], ['2009-02-14T00:31:30.123456+01', '1234567890.123456'], ['2009-02-13T22:31:30.123456-01', '1234567890.123456'], ['2009-02-14 00:31:30.123456+01', '1234567890.123456'], ['2009-02-13 22:31:30.123456-01', '1234567890.123456']], 'MW': [['20090213233130', '1234567890.000000']], 'POSIX': [['1234567890', '1234567890.000000'], ['-1234567890', '-1234567890.000000'], ['1234567890.123', '1234567890.123000'], ['-1234567890.123', '-1234567890.123000'], ['1234567890.123456', '1234567890.123456'], ['-1234567890.123456', '-1234567890.123456'], ['1234567890.000001', '1234567890.000001'], ['-1234567890.000001', '-1234567890.000001']]}#
test_set_from_datetime()[source]#

Test creating instance from datetime.datetime object.

test_set_from_string_invalid()[source]#

Test failure creating instance from invalid string.

test_set_from_string_iso8601()[source]#

Test creating instance from ISO8601 string.

test_set_from_string_mw()[source]#

Test creating instance from MW string.

test_set_from_string_posix()[source]#

Test creating instance from POSIX string.

test_set_from_timestamp()[source]#

Test creating instance from Timestamp object.

test_short_mediawiki_format()[source]#

Test short mw timestamp conversion from and to Timestamp format.

test_sub_timedate()[source]#

Test subtracting two timestamps.

test_sub_timedelta()[source]#

Test subtracting a timedelta from a Timestamp.