<s> import pytest <EOL> import datetime as dt <EOL> from mock import MagicMock <EOL> from gitfs . utils . strptime import TimeParser <EOL> from gitfs . utils import strptime <EOL> class TestDateTimeUtils ( object ) : <EOL> def test_strptime ( self ) : <EOL> date = dt . date ( <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> ) <EOL> datetime = dt . datetime ( <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert strptime ( "<STR_LIT>" , "<STR_LIT>" ) == date <EOL> assert strptime ( "<STR_LIT>" , "<STR_LIT>" , <EOL> to_datetime = True ) == datetime <EOL> date = dt . date ( <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT:30> ) <EOL> datetime = dt . datetime ( <NUM_LIT> , <NUM_LIT:8> , <NUM_LIT:30> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> assert strptime ( "<STR_LIT>" , "<STR_LIT>" ) == date <EOL> assert strptime ( "<STR_LIT>" , "<STR_LIT>" , <EOL> to_datetime = True ) == datetime <EOL> date = dt . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> datetime = dt . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT> , <NUM_LIT:30> ) <EOL> assert strptime ( "<STR_LIT>" , "<STR_LIT>" ) == date <EOL> assert strptime ( "<STR_LIT>" , "<STR_LIT>" , <EOL> to_datetime = True ) == datetime <EOL> with pytest . raises ( ValueError ) : <EOL> strptime ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> def test_time_parser_match_with_value_error ( self ) : <EOL> mocked_pattern = MagicMock ( ) <EOL> mocked_pattern . match . return_value = False <EOL> parser = TimeParser ( "<STR_LIT>" ) <EOL> parser . pattern = mocked_pattern <EOL> with pytest . raises ( ValueError ) : <EOL> parser . match ( "<STR_LIT>" ) <EOL> mocked_pattern . match . assert_called_once_with ( "<STR_LIT>" ) </s>
