24 lines
684 B
Python
24 lines
684 B
Python
"""Tests for the NORAD ID normaliser."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from odm import normalise_norad
|
|
|
|
|
|
@pytest.mark.parametrize("raw,expected", [
|
|
(None, None),
|
|
("", None),
|
|
(" ", None),
|
|
(25544, "25544"),
|
|
("25544", "25544"),
|
|
(" 25544 ", "25544"),
|
|
("123", "00123"), # zero-padded to 5
|
|
(b"42", "00042"), # bytes accepted, zero-padded
|
|
("A1234", "A1234"), # alphanumeric preserved verbatim
|
|
("1998-067A", "1998-067A"), # hyphenated preserved verbatim
|
|
("12345678", "12345678"), # >5 digits left intact
|
|
])
|
|
def test_normalise_norad(raw, expected):
|
|
assert normalise_norad(raw) == expected
|