예제 #1
0
    def test_time_to_seconds_no_timezone(self):
        with pytest.raises(TypeError) as excinfo:
            primitives.DateTimeField().process_bind_param(
                "2011-05-24T22:00:02", "postgres")

        assert "The DateTime 2011-05-24T22:00:02 is invalid" in str(
            excinfo.value)
예제 #2
0
    def test_not_allow_2400_hrs(self):
        with pytest.raises(TypeError) as excinfo:
            primitives.DateTimeField().process_bind_param(
                "2011-05-24T24:00:00", "postgres")

        assert "The DateTime 2011-05-24T24:00:00 is invalid" in str(
            excinfo.value)
예제 #3
0
 def test_code_accept_none_values(self):
     result = primitives.DateTimeField().process_bind_param(
         None, "postgres")
     assert result is None
예제 #4
0
 def test_time_with_timezone(self):
     result = primitives.DateTimeField().process_bind_param(
         "2011-05-24T22:00:00+03:14", "postgres")
     assert result == "2011-05-24T22:00:00+03:14"
예제 #5
0
 def test_only_day_month_and_year(self):
     result = primitives.DateTimeField().process_bind_param(
         "2011-05-24", "postgres")
     assert result == "2011-05-24"