File: test_abstract_classes.py

package info (click to toggle)
python-spdx-tools 0.8.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,084 kB
  • sloc: python: 18,675; xml: 12,553; sh: 46; makefile: 7
file content (14 lines) | stat: -rw-r--r-- 511 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# SPDX-FileCopyrightText: 2023 spdx contributors
#
# SPDX-License-Identifier: Apache-2.0
import pytest

from spdx_tools.spdx3.model import Artifact, Element, ElementCollection, IntegrityMethod


@pytest.mark.parametrize("abstract_class", [Element, Artifact, ElementCollection, IntegrityMethod])
def test_initialization_throws_error(abstract_class):
    with pytest.raises(TypeError) as err:
        abstract_class()

    assert f"Can't instantiate abstract class {abstract_class.__name__}" in err.value.args[0]