def test_sorting(self): """ Test correct sorting of various keywords. """ self.assertEqual( update_keywords(['arm', '-sparc', '~alpha', '~x86-fbsd', '~amd64-linux'], ['amd64-fbsd', 'amd64-macos', 'hppa', 'arm64'], stable=False), ['~alpha', 'arm', '~arm64', '~hppa', '-sparc', '~amd64-fbsd', '~x86-fbsd', '~amd64-linux', '~amd64-macos'])
def test_cleanup_redundant(self): """ Test that redundant keywords are removed. """ self.assertEqual( update_keywords(['-alpha', '~alpha', '-arm', '-arm64', '~arm64', '-hppa', '~hppa', 'hppa', '~sparc', '-x86', 'x86'], ['arm', 'arm64', 'sparc'], stable=True), ['~alpha', 'arm', 'arm64', 'hppa', 'sparc', 'x86'])
def test_noop_to_testing(self): """ Test trying to keyword already-keyworded arch. """ self.assertIsNone( update_keywords(['arm', '-sparc', '~alpha'], ['alpha'], stable=False))
def test_upgrade_to_stable_from_negative(self): """ Test upgrading to stable from -arch. """ self.assertEqual( update_keywords(['arm', '~alpha', '-sparc'], ['sparc'], stable=True), ['~alpha', 'arm', 'sparc'])
def test_noop_to_stable(self): """ Test trying to stabilize already-stable arch. """ self.assertIsNone( update_keywords(['arm', '-sparc', '~alpha'], ['arm'], stable=True))
def test_upgrade_to_stable(self): """ Test upgrading keywords from ~arch to stable. """ self.assertEqual( update_keywords(['~arm', '-sparc', '~alpha'], ['arm'], stable=True), ['~alpha', 'arm', '-sparc'])
def test_add_testing_keywords(self): """ Test adding testing keywords to other keywords. """ self.assertEqual( update_keywords(['arm', '-sparc', '~alpha'], ['x86', 'amd64'], stable=False), ['~alpha', '~amd64', 'arm', '-sparc', '~x86'])
def test_add_stable_keywords(self): """ Test adding stable keywords to other keywords. """ self.assertEqual( update_keywords(['arm', '-sparc', '~alpha'], ['x86', 'amd64'], stable=True), ['~alpha', 'amd64', 'arm', '-sparc', 'x86'])
def test_new_testing_keywords(self): """ Test adding new testing keywords to an empty list. """ self.assertEqual( update_keywords([], ['x86', 'amd64'], stable=False), ['~amd64', '~x86'])
def test_new_stable_keywords(self): """ Test adding new stable keywords to an empty list. """ self.assertEqual( update_keywords([], ['x86', 'amd64'], stable=True), ['amd64', 'x86'])