Added tests for `parse_timestmp` of `djblets.log.views` to address missing test cases

Review Request #9504 — Created Jan. 20, 2018 and updated

rodgerwa
Djblets
master
4590
80559c5...
djblets

Added tests for djblets.log.views for testing the parse_timestamp
function.

The included tests try the following cases with provided timestamp
format string:
- Empty String of '' being passed
- A string containing something other than a date ('jibberish')
- An invalid date where the month is out of bounds
('1990-55-09 22:11:30')
- A valid date input string ('1990-01-01 20:20:20')

Based most of this behavior off how parse_timestamp behaved in the
interpreter with various inputs. To be more accurate with testing
would require the default implementation for time and datetime,
which mightbe something to be considered with future changes to
python versions however but isn't required for
the scope of this project.

I ran ./tests/runtests djblets.log.tests and
./tests/runtests djblets.log and both pass along with
all other test cases.

Description From Last Updated

The bug number should go in the bugs field. The bug number should not be in the summary or description.

brenniebrennie

You will want to give our guide on change descriptions a read and edit your summary and description to match. ...

brenniebrennie

Your testing done should be capititalized appropriately. You can make the bits look like code with: `code`

brenniebrennie

Can you wrap your description and testing done at 72 characters?

brenniebrennie

Testing done needs to be capitalized and should end in a period.

brenniebrennie

Needs a file-level docstring describing the module. "Unit tests for djblets.log.views" is fine.

brenniebrennie

Unnecessary.

brenniebrennie

Needs a docstring.

brenniebrennie

Needs a docstring.

brenniebrennie

Needs a docstring.

brenniebrennie

Needs a docstring. invalid_date.

brenniebrennie

valid_date (reads like validate otherwise) Also needs a docstring.

brenniebrennie

Test docstrings shouldn't end in periods because the test runner will append a "..."

daviddavid

Same heere.

daviddavid

And here.

daviddavid

And here.

daviddavid

Proper grammar should be "There aren't 55 months"

daviddavid
RO
brennie
  1. 
      
  2. The bug number should go in the bugs field.

    The bug number should not be in the summary or description.

  3. You will want to give our guide on change descriptions a read and edit your summary and description to match. Change descriptions should be stand-alone and not require looking up a bug to find out what the change does.

    1. I think my latted change addresses this. Let me know.

    2. lattest*

  4. Your testing done should be capititalized appropriately.

    You can make the bits look like code with:

    `code`
    
  5. djblets/log/tests/test_log_views.py (Diff revision 1)
     
     

    Needs a file-level docstring describing the module. "Unit tests for djblets.log.views" is fine.

    1. So add a docstring for the first line of the file?

  6. djblets/log/tests/test_log_views.py (Diff revision 1)
     
     

    Unnecessary.

  7. djblets/log/tests/test_log_views.py (Diff revision 1)
     
     

    Needs a docstring.

  8. djblets/log/tests/test_log_views.py (Diff revision 1)
     
     

    Needs a docstring.

  9. djblets/log/tests/test_log_views.py (Diff revision 1)
     
     

    Needs a docstring.

  10. djblets/log/tests/test_log_views.py (Diff revision 1)
     
     

    Needs a docstring. invalid_date.

  11. djblets/log/tests/test_log_views.py (Diff revision 1)
     
     

    valid_date (reads like validate otherwise)

    Also needs a docstring.

  12. 
      
RO
RO
RO
RO
brennie
  1. 
      
  2. Can you wrap your description and testing done at 72 characters?

  3. Testing done needs to be capitalized and should end in a period.

  4. 
      
david
  1. 
      
  2. djblets/log/tests/test_log_views.py (Diff revision 2)
     
     

    Test docstrings shouldn't end in periods because the test runner will append a "..."

  3. djblets/log/tests/test_log_views.py (Diff revision 2)
     
     

    Same heere.

  4. djblets/log/tests/test_log_views.py (Diff revision 2)
     
     

    And here.

  5. djblets/log/tests/test_log_views.py (Diff revision 2)
     
     

    And here.

  6. 
      
RO
Review request changed

Change Summary:

Address formatting, punctuation, and doctrings

Description:

~  

Added tests for djblets.log.views for testing the parse_timestamp function.

  ~

Added tests for djblets.log.views for testing the parse_timestamp

  + function.

   
~  

The included tests try the following cases with provided timestamp format string:

  ~

The included tests try the following cases with provided timestamp

  + format string:
    - Empty String of '' being passed
    - A string containing something other than a date ('jibberish')
~   - An invalid date where the month is out of bounds ('1990-55-09 22:11:30')
  ~ - An invalid date where the month is out of bounds
  + ('1990-55-09 22:11:30')
    - A valid date input string ('1990-01-01 20:20:20')

   
~  

Based most of this behavior off how parse_timestamp behaved in the interpreter with various inputs. To get more accurate testing would be testing the default implementation for time and datetime, which might be something to be considered with future changes to python version however isn't required for the scope of this project.

  ~

Based most of this behavior off how parse_timestamp behaved in the

  + interpreter with various inputs. To be more accurate with testing
  + would require the default implementation for time and datetime,
  + which mightbe something to be considered with future changes to
  + python versions however but isn't required for
  + the scope of this project.

Testing Done:

~  

ran ./tests/runtests djblets.log.tests and ./tests/runtests djblets.log and both pass along with all other test cases

  ~

I ran ./tests/runtests djblets.log.tests and

  + ./tests/runtests djblets.log and both pass along with
  + all other test cases.

Diff:

Revision 3 (+33)

Show changes

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
david
  1. 
      
  2. djblets/log/tests/test_log_views.py (Diff revision 3)
     
     

    Proper grammar should be "There aren't 55 months"

  3. 
      
Loading...