예제 #1
0
def test_get_time_pass_through():
    test_time = datetime(1992, 3, 12, 15, 3, 30, tzinfo=UTC)
    assert_equals("Mar 12, 1992 at 15:03 UTC", get_time_display(test_time))
    assert_equals("Mar 12, 1992 at 15:03 UTC",
                  get_time_display(test_time, None))
    assert_equals("Mar 12, 1992 at 15:03 UTC",
                  get_time_display(test_time, "%"))
예제 #2
0
def test_get_time_display():
    test_time = datetime(1992, 3, 12, 15, 3, 30, tzinfo=UTC)
    assert_equals("dummy text", get_time_display(test_time, 'dummy text'))
    assert_equals("Mar 12 1992", get_time_display(test_time, '%b %d %Y'))
    assert_equals("Mar 12 1992 UTC", get_time_display(test_time,
                                                      '%b %d %Y %Z'))
    assert_equals("Mar 12 15:03", get_time_display(test_time, '%b %d %H:%M'))
예제 #3
0
def test_get_time_display_coerce():
    test_time_standard = datetime(1992, 1, 12, 15, 3, 30, tzinfo=UTC)
    test_time_daylight = datetime(1992, 7, 12, 15, 3, 30, tzinfo=UTC)
    assert_equals(
        "Jan 12, 1992 at 07:03 PST",
        get_time_display(test_time_standard, None, coerce_tz="US/Pacific"))
    assert_equals(
        "Jan 12, 1992 at 15:03 UTC",
        get_time_display(test_time_standard, None, coerce_tz="NONEXISTENTTZ"))
    assert_equals(
        "Jan 12 07:03",
        get_time_display(test_time_standard,
                         '%b %d %H:%M',
                         coerce_tz="US/Pacific"))
    assert_equals(
        "Jul 12, 1992 at 08:03 PDT",
        get_time_display(test_time_daylight, None, coerce_tz="US/Pacific"))
    assert_equals(
        "Jul 12, 1992 at 15:03 UTC",
        get_time_display(test_time_daylight, None, coerce_tz="NONEXISTENTTZ"))
    assert_equals(
        "Jul 12 08:03",
        get_time_display(test_time_daylight,
                         '%b %d %H:%M',
                         coerce_tz="US/Pacific"))
예제 #4
0
def test_get_time_display_coerce():
    test_time_standard = datetime(1992, 1, 12, 15, 3, 30, tzinfo=UTC)
    test_time_daylight = datetime(1992, 7, 12, 15, 3, 30, tzinfo=UTC)
    assert_equals("Jan 12, 1992 at 07:03 PST",
                  get_time_display(test_time_standard, None, coerce_tz="US/Pacific"))
    assert_equals("Jan 12, 1992 at 15:03 UTC",
                  get_time_display(test_time_standard, None, coerce_tz="NONEXISTENTTZ"))
    assert_equals("Jan 12 07:03",
                  get_time_display(test_time_standard, '%b %d %H:%M', coerce_tz="US/Pacific"))
    assert_equals("Jul 12, 1992 at 08:03 PDT",
                  get_time_display(test_time_daylight, None, coerce_tz="US/Pacific"))
    assert_equals("Jul 12, 1992 at 15:03 UTC",
                  get_time_display(test_time_daylight, None, coerce_tz="NONEXISTENTTZ"))
    assert_equals("Jul 12 08:03",
                  get_time_display(test_time_daylight, '%b %d %H:%M', coerce_tz="US/Pacific"))
예제 #5
0
def test_get_time_pass_through():
    test_time = datetime(1992, 3, 12, 15, 3, 30, tzinfo=UTC)
    assert_equals("Mar 12, 1992 at 15:03 UTC", get_time_display(test_time))
    assert_equals("Mar 12, 1992 at 15:03 UTC", get_time_display(test_time, None))
    assert_equals("Mar 12, 1992 at 15:03 UTC", get_time_display(test_time, "%"))
예제 #6
0
def test_get_time_display():
    test_time = datetime(1992, 3, 12, 15, 3, 30, tzinfo=UTC)
    assert_equals("dummy text", get_time_display(test_time, 'dummy text'))
    assert_equals("Mar 12 1992", get_time_display(test_time, '%b %d %Y'))
    assert_equals("Mar 12 1992 UTC", get_time_display(test_time, '%b %d %Y %Z'))
    assert_equals("Mar 12 15:03", get_time_display(test_time, '%b %d %H:%M'))
예제 #7
0
def test_get_time_disp_ret_empty():
    assert_equals("", get_time_display(None))
    test_time = datetime(1992, 3, 12, 15, 3, 30, tzinfo=UTC)
    assert_equals("", get_time_display(test_time, ""))