scrapy_mosquitera.matchers.date._to_datetime

Here are the examples of the python api scrapy_mosquitera.matchers.date._to_datetime taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

Example 1

Project: scrapy-mosquitera
Source File: test_date.py
View license
@then('transforming an invalid date string raises exception')
def transforming_an_invalid_date_string_raises_exception(invalid_date_string):
    try:
        _to_datetime(invalid_date_string)
        assert False
    except TypeError:
        assert True

Example 2

Project: scrapy-mosquitera
Source File: test_date.py
View license
@then('transforming datetime to datetime returns the same object')
def transforming_datetime_to_datetime_returns_the_same_object(datetime_obj):
    rs = _to_datetime(datetime_obj)
    assert rs == datetime_obj

Example 3

Project: scrapy-mosquitera
Source File: test_date.py
View license
@then('transforming date string to datetime returns a valid datetime object')
def transforming_date_string_to_datetime_returns_a_valid_datetime_object(date_string):
    rs = _to_datetime(date_string)
    assert isinstance(rs, datetime.datetime)

Example 4

Project: scrapy-mosquitera
Source File: test_date.py
View license
@then('transforming date object to datetime returns a valid datetime object')
def transforming_date_object_to_datetime_returns_a_valid_datetime_object(date_obj):
    rs = _to_datetime(date_obj)
    assert isinstance(rs, datetime.datetime)