diff --git a/tests/standalone_plugins/changed_packages/test_package.py b/tests/standalone_plugins/changed_packages/test_package.py index 803c87690..4734ba93e 100644 --- a/tests/standalone_plugins/changed_packages/test_package.py +++ b/tests/standalone_plugins/changed_packages/test_package.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from argparse import ArgumentError from unittest import TestCase from troubadix.standalone_plugins.changed_packages.package import ( @@ -30,25 +31,36 @@ def test_from_cli_argument(self): Reasons.from_cli_argument("dropped-architecture"), ) + def test_from_cli_argument_not_okay(self): + with self.assertRaises(ArgumentError): + Reasons.from_cli_argument("foo") + + def test_str(self): + self.assertEqual(str(Reasons.ADDED_EPOCH), "added-epoch") + class PackageTestCase(TestCase): - def test_lt(self): + def test_lt_by_name(self): package = Package("a-foo", "1.2.3", "DEB11") other_package = Package("b-foo", "1.2.3", "DEB11") self.assertLess(package, other_package) + def test_lt_by_version(self): package = Package("foo", "1.2.3", "DEB11") other_package = Package("foo", "2.2.3", "DEB11") - print( - (package.release, package.name, package.version) - < (other_package.release, other_package.name, other_package.version) - ) - self.assertLess(package, other_package) + def test_lt_by_release(self): package = Package("foo", "1.2.3", "DEB10") other_package = Package("foo", "1.2.3", "DEB11") self.assertLess(package, other_package) + + def test_lt_nothing_in_common(self): + package = Package("foo", "1.2.3", "DEB10") + other_package = Package("foo", "1.2.3", "DEB10") + + self.assertFalse(package < other_package) + self.assertFalse(package > other_package)