File: test_enums.py

package info (click to toggle)
python-confluent-kafka 2.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,660 kB
  • sloc: python: 30,428; ansic: 9,487; sh: 1,477; makefile: 192
file content (25 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (2)
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