From 97a5985440900111180511991553c847b96515b3 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: May 08 2020 23:28:47 +0000 Subject: test_helpers: pylint cleanups Signed-off-by: Adam Williamson --- diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 8c50dc7..70bd6be 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -20,7 +20,8 @@ # these are all kinda inappropriate for pytest patterns # pylint: disable=no-init, protected-access, no-self-use, unused-argument -import os +"""Tests for helpers.py.""" + from unittest import mock import pytest @@ -74,12 +75,14 @@ STANDARD_SORTS = [ class TestHelpers: """Tests for the functions in helpers.py.""" def test_fedora_release_sort(self): + """Test for fedora_release_sort.""" rels = OLD_SORTS + STANDARD_SORTS for (num, rel) in enumerate(rels[1:], 1): prevrel = rels[num-1] assert hl.fedora_release_sort(' '.join(rel)) > hl.fedora_release_sort(' '.join(prevrel)) def test_triplet_sort(self): + """Test for triplet_sort and triplet_unsort.""" rels = HARD_SORTS + OLD_SORTS + STANDARD_SORTS for (num, rel) in enumerate(rels[1:], 1): prevrel = rels[num-1] @@ -88,6 +91,7 @@ class TestHelpers: assert hl.triplet_unsort(*sorttup) == (rel) def test_rreplace(self): + """Tests for rreplace.""" foos = "foofoofoo" bars = "barbarbar" assert hl.rreplace(bars, "bar", "foo", 1) == "barbarfoo" @@ -98,12 +102,14 @@ class TestHelpers: assert hl.rreplace(foos, "bar", "foo", 3) == "foofoofoo" def test_normalize(self): + """Tests for normalize.""" wikitext = "Foo_Bar Moo" oktext = "foo_bar_moo" assert hl.normalize(wikitext) == oktext assert hl.normalize(oktext) == oktext def test_find_bugs(self): + """Test for find_bugs.""" # text taken from a real Test Day page - # 2011-03-24_Power_Management - with a [[rhbug link # added as I couldn't find a page with all three. Some non-bug @@ -127,6 +133,7 @@ class TestHelpers: @mock.patch('fedfind.release.ModularProduction.cid', 'Fedora-Modular-27-20171108.2') @mock.patch('fedfind.release.ModularProduction.label', 'Beta-1.5') def test_cid_to_event(self, fakecurr): + """Tests for cid_to_event.""" bran = hl.cid_to_event('Fedora-24-20160314.n.2') assert bran == ('Fedora', '24', 'Branched', '20160314.n.2') modbran = hl.cid_to_event('Fedora-Modular-27-20171110.n.1') @@ -150,7 +157,9 @@ class TestHelpers: @mock.patch('fedfind.release.Production.cid', 'Fedora-24-20160314.1') @mock.patch('fedfind.release.Production.label', '') def test_cid_to_event_fail(self, fakecurr): - # check that we fail if we cannot determine label for production compose + """Test to check cid_to_event fails if we cannot determine + label for production compose. + """ with pytest.raises(ValueError): hl.cid_to_event('Fedora-24-20160314.1')