Beispiel #1
0
    def test_serialize_zero_datetime(self):
        """
        Test serialization where timestamp = 0

        Companion test for test_deserialize_zero_datetime

        @since 2.0.0
        @jira_ticket PYTHON-729
        @expected_result serialization doesn't raise an error

        @test_category data_types
        """
        DateRangeType.serialize(
            util.DateRange(lower_bound=(datetime.datetime(1970, 1, 1), 'YEAR'),
                           upper_bound=(datetime.datetime(1970, 1,
                                                          1), 'YEAR')), 5)
Beispiel #2
0
 def test_serialized_value_round_trip(self):
     vals = [
         six.
         b('\x01\x00\x00\x01%\xe9a\xf9\xd1\x06\x00\x00\x01v\xbb>o\xff\x00'),
         six.
         b('\x01\x00\x00\x00\xdcm\x03-\xd1\x06\x00\x00\x01v\xbb>o\xff\x00')
     ]
     for serialized in vals:
         self.assertEqual(
             serialized,
             DateRangeType.serialize(
                 DateRangeType.deserialize(serialized, 0), 0))
Beispiel #3
0
 def test_serialize_both_open(self):
     serialized = DateRangeType.serialize(
         util.DateRange(lower_bound=util.OPEN_BOUND,
                        upper_bound=util.OPEN_BOUND), 5)
     self.assertEqual(int8_pack(4), serialized)
Beispiel #4
0
 def test_serialize_single_open(self):
     serialized = DateRangeType.serialize(
         util.DateRange(value=util.OPEN_BOUND, ), 5)
     self.assertEqual(int8_pack(5), serialized)