File: test_version.py

package info (click to toggle)
python-sphinx-chango 0.5.0-2
  • links: PTS
  • area: main
  • in suites: sid
  • size: 1,776 kB
  • sloc: python: 4,909; javascript: 74; makefile: 23
file content (22 lines) | stat: -rw-r--r-- 590 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
#  SPDX-FileCopyrightText: 2024-present Hinrich Mahler <chango@mahlerhome.de>
#
#  SPDX-License-Identifier: MIT
import datetime as dtm

import pytest

from chango import Version


class TestVersion:
    def test_init(self):
        v = Version("1.2.3", dtm.date(2024, 1, 1))
        assert v.uid == "1.2.3"
        assert v.date == dtm.date(2024, 1, 1)

    def test_frozen(self):
        v = Version("1.2.3", dtm.date(2024, 1, 1))
        with pytest.raises(AttributeError):
            v.uid = "1.2.4"
        with pytest.raises(AttributeError):
            v.date = dtm.date(2024, 1, 2)