Commit a9e41899 authored by Hanno Schlichting's avatar Hanno Schlichting

More trivial tests

parent 5107666a
...@@ -138,6 +138,7 @@ class ValueIndexes(object): ...@@ -138,6 +138,7 @@ class ValueIndexes(object):
@classmethod @classmethod
def set(cls, value): def set(cls, value):
value = frozenset(value)
with cls.lock: with cls.lock:
cls.value = value cls.value = value
...@@ -172,7 +173,7 @@ class ValueIndexes(object): ...@@ -172,7 +173,7 @@ class ValueIndexes(object):
# greater than zero # greater than zero
value_indexes.add(name) value_indexes.add(name)
cls.set(frozenset(value_indexes)) cls.set(value_indexes)
return value_indexes return value_indexes
......
...@@ -155,7 +155,38 @@ class TestReports(unittest.TestCase): ...@@ -155,7 +155,38 @@ class TestReports(unittest.TestCase):
self.assertEquals(type(self.reports.lock), LockType) self.assertEquals(type(self.reports.lock), LockType)
# class TestValueIndexes(unittest.TestCase): class TestValueIndexes(unittest.TestCase):
def setUp(self):
self.value = self._makeOne()
def tearDown(self):
self.value.clear()
def _makeOne(self):
from ..plan import ValueIndexes
return ValueIndexes
def test_get(self):
self.assertEquals(self.value.get(), frozenset())
def test_set(self):
indexes = ('index1', 'index2')
self.value.set(indexes)
self.assertEquals(self.value.get(), frozenset(indexes))
def test_clear(self):
self.value.set(('index1', ))
self.value.clear()
self.assertEquals(self.value.get(), frozenset())
def test_determine_already_set(self):
self.value.set(('index1', ))
self.assertEquals(self.value.determine(()), frozenset(('index1', )))
# class TestValueIndexesDetermination(unittest.TestCase):
# Test the actual logic for determining value indexes
# class TestMakeKey(unittest.TestCase): # class TestMakeKey(unittest.TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment