summaryrefslogtreecommitdiff
path: root/rtemsspec/tests
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-21 11:13:15 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-21 11:15:24 +0100
commit48058608c263970f310837ae0787d1f2ef490529 (patch)
tree5be899c6f5a60eb028ebf0ad99866e81c2724e5a /rtemsspec/tests
parentf1b569ec4b5b3d8dc47396018fef675d2e1dd11f (diff)
content: Reject copyright statements without a year
Diffstat (limited to 'rtemsspec/tests')
-rw-r--r--rtemsspec/tests/test_content_copyrights.py39
-rw-r--r--rtemsspec/tests/test_content_sphinx.py4
2 files changed, 23 insertions, 20 deletions
diff --git a/rtemsspec/tests/test_content_copyrights.py b/rtemsspec/tests/test_content_copyrights.py
index 99db8ed4..d33bcf0c 100644
--- a/rtemsspec/tests/test_content_copyrights.py
+++ b/rtemsspec/tests/test_content_copyrights.py
@@ -32,16 +32,15 @@ from rtemsspec.content import Copyrights
def test_copyright_get_statement():
c = Copyright("John Doe")
- assert "Copyright (C) John Doe" == c.get_statement()
- c.add_year("3")
+ c.add_year(3)
assert "Copyright (C) 3 John Doe" == c.get_statement()
- c.add_year("3")
+ c.add_year(3)
assert "Copyright (C) 3 John Doe" == c.get_statement()
- c.add_year("5")
+ c.add_year(5)
assert "Copyright (C) 3, 5 John Doe" == c.get_statement()
- c.add_year("4")
+ c.add_year(4)
assert "Copyright (C) 3, 5 John Doe" == c.get_statement()
- c.add_year("2")
+ c.add_year(2)
assert "Copyright (C) 2, 5 John Doe" == c.get_statement()
@@ -49,30 +48,34 @@ def test_copyright_lt():
a = Copyright("A")
b = Copyright("B")
c = Copyright("C")
+ a.add_year(2)
+ b.add_year(2)
+ c.add_year(2)
assert b < a
assert c < a
assert c < b
- b.add_year("1")
- assert b < c
- a.add_year("2")
- assert a < b
+ b.add_year(3)
+ assert c < b
+ b.add_year(1)
+ assert b < a
def test_copyrights_register():
c = Copyrights()
with pytest.raises(ValueError):
c.register("abc")
- c.register("Copyright (C) A")
c.register("Copyright (C) 2 A")
c.register("Copyright (C) 2, 3 A")
- c.register("Copyright (C) D")
+ c.register("Copyright (C) 2, 4 C")
+ c.register("Copyright (C) 3 E")
+ c.register("Copyright (C) 2, 4 E")
c.register("Copyright (C) 1 D")
c.register("Copyright (C) 1, 4 D")
- c.register("Copyright (C) C")
c.register("Copyright (C) 1 B")
s = c.get_statements()
- assert 4 == len(s)
- assert "Copyright (C) C" == s[0]
- assert "Copyright (C) 2, 3 A" == s[1]
- assert "Copyright (C) 1, 4 D" == s[2]
- assert "Copyright (C) 1 B" == s[3]
+ assert 5 == len(s)
+ assert "Copyright (C) 2, 4 C" == s[0]
+ assert "Copyright (C) 2, 4 E" == s[1]
+ assert "Copyright (C) 2, 3 A" == s[2]
+ assert "Copyright (C) 1, 4 D" == s[3]
+ assert "Copyright (C) 1 B" == s[4]
diff --git a/rtemsspec/tests/test_content_sphinx.py b/rtemsspec/tests/test_content_sphinx.py
index 7a9ecd7c..00be7a5f 100644
--- a/rtemsspec/tests/test_content_sphinx.py
+++ b/rtemsspec/tests/test_content_sphinx.py
@@ -276,12 +276,12 @@ def test_license_and_copyrights():
content = SphinxContent()
with pytest.raises(ValueError):
content.register_license("x")
- content.register_copyright("Copyright (C) A")
+ content.register_copyright("Copyright (C) 123 A")
assert str(content) == ""
content.add_licence_and_copyrights()
assert str(content) == """.. SPDX-License-Identifier: CC-BY-SA-4.0
-.. Copyright (C) A
+.. Copyright (C) 123 A
"""