Ejemplo n.º 1
0
class TestColorData(unittest.TestCase):

    def setUp(self):
        builder = MockBuilder()
        blockchain = MockBlockchain()
        store = MockStore()
        colormap = MockColorMap()
        self.thick = ThickColorData(builder, blockchain, store, colormap)
        self.thin = ThinColorData(builder, blockchain, store, colormap)

    def test_thick(self):
        self.assertRaises(UnfoundTransactionError, self.thick.get_colorvalues,
                          set([1,2]), '', 0)
        cvs = self.thick.get_colorvalues(set([1,2]), '1', 0)
        self.assertEquals(cvs[0].get_value(), 5)
        self.assertEquals(cvs[1].get_value(), 6)
        cvs = self.thick.get_colorvalues(set([1,2]), '2', 0)
        self.assertEquals(cvs[0].get_value(), 5)
        self.assertEquals(cvs[1].get_value(), 6)

        self.assertRaises(UnfoundTransactionError, self.thick.get_colorvalues,
                          set([1,2]), '9', 0)

    def test_thin(self):
        self.assertRaises(UnfoundTransactionError, self.thin.get_colorvalues,
                          set([1,2]), 'nope', 0)
        cvs = self.thin.get_colorvalues(set([1,2]), '1', 0)
        self.assertEquals(cvs[0].get_value(), 5)
        self.assertEquals(cvs[1].get_value(), 6)
        cvs = self.thin.get_colorvalues(set([1,2]), '2', 0)
        self.assertEquals(cvs[0].get_value(), 5)
        self.assertEquals(cvs[1].get_value(), 6)
Ejemplo n.º 2
0
 def setUp(self):
     builder = MockBuilder()
     blockchain = MockBlockchain()
     store = MockStore()
     colormap = MockColorMap()
     self.thick = ThickColorData(builder, blockchain, store, colormap)
     self.thin = ThinColorData(builder, blockchain, store, colormap)
Ejemplo n.º 3
0
 def makeBuilder(self):
     self.cdbuilder = ColorDataBuilderManager(self.colormap,
                                              self.blockchain_state,
                                              self.cdstore, self.metastore,
                                              AidedColorDataBuilder)
     self.colordata = ThinColorData(self.cdbuilder, self.blockchain_state,
                                    self.cdstore, self.colormap)