Пример #1
0
    def dates_are_converted_to_iso_strings(self):
        import datetime

        serializer = Serializer()
        serialized = serializer.serialize(datetime.date(2011, 8, 2))

        assert_equal(serialized, '2011-08-02')
Пример #2
0
    def dates_are_converted_to_iso_strings(self):
        import datetime

        serializer = Serializer()
        serialized = serializer.serialize(datetime.date(2011,8,2))

        assert_equal(serialized, '2011-08-02')
Пример #3
0
    def should_return_the_set_of_field_names_and_keys_to_use_for_a_dict(self):
        from datetime import date
        obj = {'f1': 'value', 'f2': 12345, 'f3': date(2011, 8, 2)}

        serializer = Serializer()
        fields = serializer.get_fields(obj)

        assert_equal(fields, set(['f1', 'f2', 'f3']))
Пример #4
0
    def should_return_the_set_of_field_names_and_keys_to_use_for_a_dict(self):
        from datetime import date
        obj = {
            'f1': 'value',
            'f2': 12345,
            'f3': date(2011, 8, 2)
        }

        serializer = Serializer()
        fields = serializer.get_fields(obj)

        assert_equal(fields, set(['f1', 'f2', 'f3']))