Adding tests for utils.dates

Review Request #8439 — Created Sept. 25, 2016 and submitted

larmiej
Djblets
master
71eddd6...
djblets, students

Djblets has some utility functions for working with dates/timestamps
that did not have any unit tests for them.
The cursor of some text fields in an edit state displayed the standard
Added new DatesTests class to djblets/util/tests.py that covers
testing for:

Calling http_date():
- With a datetime object.
- With a string representing a date.
- With an integer representing a Unix timestamp (seconds since the
epoch).

Calling get_latest_timestamp():
- Without any timestamps in the list (result should be None)
- With a list of timestamps of different values in a jumbled,
unsorted order, checking that the latest gets returned.

Calling get_tz_aware_utcnow() and checking that the resulting
datetime's timezone is UTC

Added tests

Description From Last Updated

'time' imported but unused

reviewbotreviewbot

Col: 80 E501 line too long (85 > 79 characters)

reviewbotreviewbot

djblets.util comes before djblets.util.foo

brenniebrennie

http_date

brenniebrennie

http_date

brenniebrennie

http_date

brenniebrennie

UTC is capitalized.

brenniebrennie

Undo this.

brenniebrennie

Same here.

brenniebrennie

Same here.

brenniebrennie

Use the function name in the docstring.

brenniebrennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/util/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/util/tests.py
    
    
  2. djblets/util/tests.py (Diff revision 1)
     
     
     'time' imported but unused
    
  3. djblets/util/tests.py (Diff revision 1)
     
     
    Col: 80
     E501 line too long (85 > 79 characters)
    
  4. 
      
LA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/util/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/util/tests.py
    
    
  2. 
      
LA
brennie
  1. 
      
  2. djblets/util/tests.py (Diff revision 2)
     
     

    djblets.util comes before djblets.util.foo

  3. 
      
LA
brennie
  1. 
      
  2. djblets/util/tests.py (Diff revision 3)
     
     

    http_date

  3. djblets/util/tests.py (Diff revision 3)
     
     

    http_date

  4. djblets/util/tests.py (Diff revision 3)
     
     

    http_date

  5. djblets/util/tests.py (Diff revision 3)
     
     

    UTC is capitalized.

  6. 
      
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/util/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/util/tests.py
    
    
  2. 
      
LA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/util/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/util/tests.py
    
    
  2. 
      
brennie
  1. 
      
  2. djblets/util/tests.py (Diff revision 4)
     
     

    Undo this.

  3. djblets/util/tests.py (Diff revision 4)
     
     

    Same here.

  4. djblets/util/tests.py (Diff revision 4)
     
     

    Same here.

  5. djblets/util/tests.py (Diff revision 4)
     
     

    Use the function name in the docstring.

  6. 
      
LA
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/util/tests.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/util/tests.py
    
    
  2. 
      
LA
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        djblets/util/tests.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        djblets/util/tests.py
    
    
  2. 
      
LA
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.10.x (6d3826e)
Loading...