Files @ 3f1b9b9b0505
Branch filter:

Location: light9/light9/collector/output_test.py

drewp@bigasterisk.com
add yapf tool
Ignore-this: 28fe07e21ca358a97282f5316c8820e0
import unittest
from light9.namespaces import L9
from light9.collector.output import setListElem, DmxOutput

class TestSetListElem(unittest.TestCase):
    def testSetExisting(self):
        x = [0, 1]
        setListElem(x, 0, 9)
        self.assertEqual([9, 1], x)
    def testSetNext(self):
        x = [0, 1]
        setListElem(x, 2, 9)
        self.assertEqual([0, 1, 9], x)
    def testSetBeyond(self):
        x = [0, 1]
        setListElem(x, 3, 9)
        self.assertEqual([0, 1, 0, 9], x)
    def testArbitraryFill(self):
        x = [0, 1]
        setListElem(x, 5, 9, fill=8)
        self.assertEqual([0, 1, 8, 8, 8, 9], x)
    def testSetZero(self):
        x = [0, 1]
        setListElem(x, 5, 0)
        self.assertEqual([0, 1, 0, 0, 0, 0], x)
    def testCombineMax(self):
        x = [0, 1]
        setListElem(x, 1, 0, combine=max)
        self.assertEqual([0, 1], x)
    def testCombineHasNoEffectOnNewElems(self):
        x = [0, 1]
        setListElem(x, 2, 1, combine=max)
        self.assertEqual([0, 1, 1], x)
        
class TestDmxOutput(unittest.TestCase):
    def testFlushIsNoop(self):
        out = DmxOutput(L9['output/udmx/'], 3)
        out.flush()