Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(7)  |  Derive(0)  |  Import(0)

src/p/o/portfoliyo-HEAD/portfoliyo/tests/test_serializers.py   portfoliyo(Download)
    def test_today(self, mock_now):
        """A date today is rendered as just the time."""
        d = datetime.datetime(2012, 1, 3, 8, 23, tzinfo=timezone.utc)
        assert serializers.naturaldatetime(d) == u"8:23am"
 
    def test_day_of_week(self, mock_now):
        """A date within the past week is rendered as weekday and time."""
        d = datetime.datetime(2013, 2, 5, 15, 45, tzinfo=timezone.utc)
        assert serializers.naturaldatetime(d) == u"Tue 3:45pm"
 
    def test_same_year(self, mock_now):
        """A date within the current year is date and time without year."""
        d = datetime.datetime(2013, 1, 15, 8, 12, tzinfo=timezone.utc)
        assert serializers.naturaldatetime(d) == u"Jan 15, 8:12am"
 
    def test_different_year(self, mock_now):
        """A date in a different year is date and time with year."""
        d = datetime.datetime(2012, 1, 15, 10, 34, tzinfo=timezone.utc)
        assert serializers.naturaldatetime(d) == u"Jan 15 2012, 10:34am"
 
    def test_today_timezone(self, mock_now):
        """Values are normalized to local time correctly."""
        d = datetime.datetime(2012, 1, 2, 23, 10, tzinfo=denver)
        with timezone.override(denver):
            assert serializers.naturaldatetime(d) == u"11:10pm"