Changeset 1572:79363bf644de


Ignore:
Timestamp:
Oct 4, 2014, 5:14:39 PM (7 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Raise a `ParserError` if the day value isn't an integer.
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ftputil/stat.py

    r1571 r1572  
    217217            month = self._month_numbers[month_abbreviation.lower()]
    218218        except KeyError:
    219             raise ftputil.error.ParserError("invalid month abbreviation '{0}'".
     219            raise ftputil.error.ParserError("invalid month abbreviation {0!r}".
    220220                                            format(month_abbreviation))
    221         day = int(day)
     221        try:
     222            day = int(day)
     223        except ValueError:
     224            raise ftputil.error.ParserError("non-integer day value {0!r}".
     225                                            format(day))
    222226        if ":" not in year_or_time:
    223227            # `year_or_time` is really a year.
  • test/test_stat.py

    r1571 r1572  
    125125          # Invalid month abbreviation
    126126          "drwxr-sr-x   2 45854    200           512 Max  4  2000 chemeng",
    127           # Invalid day value
     127          # Day value is not an integer
     128          "drwxr-sr-x   2 45854    200           512 May ab  2000 chemeng",
     129          # Day value too large
    128130          "drwxr-sr-x   2 45854    200           512 May 32  2000 chemeng",
    129131          # Incomplete mode
Note: See TracChangeset for help on using the changeset viewer.