File: test_enums.py

package info (click to toggle)
python-confluent-kafka 1.7.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 1,900 kB
  • sloc: python: 8,335; ansic: 6,065; sh: 1,203; makefile: 178
file content (25 lines) | stat: -rw-r--r-- 854 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python

import confluent_kafka


def test_enums():
    """ Make sure librdkafka error enums are reachable directly from the
        KafkaError class without an instantiated object. """
    print(confluent_kafka.KafkaError._NO_OFFSET)
    print(confluent_kafka.KafkaError.REBALANCE_IN_PROGRESS)


def test_tstype_enums():
    """ Make sure librdkafka tstype enums are available. """
    assert confluent_kafka.TIMESTAMP_NOT_AVAILABLE == 0
    assert confluent_kafka.TIMESTAMP_CREATE_TIME == 1
    assert confluent_kafka.TIMESTAMP_LOG_APPEND_TIME == 2


def test_offset_consts():
    """ Make sure librdkafka's logical offsets are available. """
    assert confluent_kafka.OFFSET_BEGINNING == -2
    assert confluent_kafka.OFFSET_END == -1
    assert confluent_kafka.OFFSET_STORED == -1000
    assert confluent_kafka.OFFSET_INVALID == -1001