Change test to use a black list instead of a white list.

This commit is contained in:
Jonathan Springer 2014-03-13 17:36:01 -04:00
parent 84b621301b
commit 2b55c1ceb5

View File

@ -32,30 +32,9 @@ Package to test for proper bzr tags.
from unittest import TestCase from unittest import TestCase
import subprocess
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
TAGS = [ BLACK_LISTED_TAGS = '2.2.2', 'help'
['1.9.0', '1'],
['1.9.1', '775'],
['1.9.2', '890'],
['1.9.3', '1063'],
['1.9.4', '1196'],
['1.9.5', '1421'],
['1.9.6', '1657'],
['1.9.7', '1761'],
['1.9.8', '1856'],
['1.9.9', '1917'],
['1.9.10', '2003'],
['1.9.11', '2039'],
['1.9.12', '2063'],
['2.0', '2118'],
['2.0.1', '?'],
['2.0.2', '?'],
['2.0.3', '?'],
['2.1.0', '2119']
]
class TestBzrTags(TestCase): class TestBzrTags(TestCase):
@ -70,9 +49,11 @@ class TestBzrTags(TestCase):
tags = [] tags = []
bzr = Popen(('bzr', 'tags'), stdout=PIPE) bzr = Popen(('bzr', 'tags'), stdout=PIPE)
stdout = bzr.communicate()[0] stdout = bzr.communicate()[0]
lines = (line.decode('utf-8') for line in stdout.splitlines()) lines = (line.decode('utf-8') for line in stdout.split())
for line in lines: for line in lines:
tags.append(line.split()) tags.append(line)
# THEN the tags should match the accepted tags # THEN none of the tags should match the black listed tags
self.assertEqual(TAGS, tags, 'List of tags should match') for BLACK_LISTED_TAG in BLACK_LISTED_TAGS:
for tag in tags:
self.assertNotEqual(BLACK_LISTED_TAG, tag, 'Tag should not exist')