Option C Tools
Loading...
Searching...
No Matches
test_compat.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# tests/tests_linter/test_compat.py
4
5"""
6Purpose
7-------
8Validate the version-parsing utility in ``oct.core.compat``.
9
10Responsibilities
11----------------
12- Confirm that normal dotted version strings parse correctly.
13- Confirm that pre-release version strings (alpha, rc) do not crash (OI-421).
14- Confirm that single-segment versions parse correctly.
15
16Diagnostics
17-----------
18Domain: LINTER-TESTS
19L2: test lifecycle
20L3: assertion details
21L4: deep tracing
22
23Contracts
24---------
25Inputs: version strings
26Outputs: pass/fail assertions
27"""
28
29from oct.core.compat import _parse_version_tuple
30
31
33 """Standard dotted version string parses correctly."""
34 assert _parse_version_tuple("2.0.0") == (2, 0, 0)
35
36
38 """Pre-release alpha string should not crash (OI-421)."""
39 result = _parse_version_tuple("2.0.0a1")
40 assert result == (2, 0, 0)
41
42
44 """Release candidate string should not crash (OI-421)."""
45 result = _parse_version_tuple("2.0.0rc2")
46 assert result == (2, 0, 0)
47
48
50 """Pre-release beta string should not crash (OI-421)."""
51 result = _parse_version_tuple("1.2.3b4")
52 assert result == (1, 2, 3)
53
54
56 """Single-segment version string parses correctly."""
57 assert _parse_version_tuple("3") == (3,)
58
59
61 """Two-segment version string parses correctly."""
62 assert _parse_version_tuple("1.2") == (1, 2)