def test_single(self): source = { 'animation': 'bibliopixel.animation.matrix.Matrix', 'shape': [23, 32], } pr = project.project(source) self.assertEqual([matrix.Matrix, 1, Matrix, Maker, 23, 32], [ type(pr.animation), len(pr.drivers), type(pr.layout), type(pr.maker), pr.layout.width, pr.layout.height, ])
def test_single(self): source = { 'animation': 'bibliopixel.animation.matrix.Matrix', 'shape': [23, 32], } pr = project.project(source) self.assertEqual( [matrix.Matrix, 1, Matrix, Maker, 23, 32], [ type(pr.animation), len(pr.drivers), type(pr.layout), type(pr.maker), pr.layout.width, pr.layout.height, ])
def make_project(data): if isinstance(data, dict): desc = data elif not isinstance(data, str): raise ValueError('Cannot understand data %s' % data) else: if '{' in data: fp = tempfile.NamedTemporaryFile(mode='w') fp.write(data) fp.seek(0) data = fp.name desc = json.load(data) return project.project(desc)
def test_single(self): source = { 'animation': { 'typename': 'bibliopixel.animation.matrix.BaseMatrixAnim', 'width': 23, 'height': 32, } } with patch.patch(defaults, 'BYPASS_PROJECT_DEFAULTS', True): pr = project.project(source) self.assertEquals([BaseMatrixAnim, 1, Matrix, Maker, 23, 32], [ type(pr.animation), len(pr.drivers), type(pr.layout), type(pr.maker), pr.layout.width, pr.layout.height, ])
def make_project(data): if isinstance(data, dict): desc = data name = None elif not isinstance(data, str): raise ValueError('Cannot understand data %s' % data) else: if '{' in data or ':' in data: fp = tempfile.NamedTemporaryFile(mode='w') fp.write(data) fp.seek(0) name = fp.name else: name = data desc = data_file.load(name) return project.project(desc, root_file=name)
def test_single(self): source = { 'animation': { 'typename': 'bibliopixel.animation.matrix.BaseMatrixAnim', 'width': 23, 'height': 32, } } with patch.patch(defaults, 'BYPASS_PROJECT_DEFAULTS', True): pr = project.project(source) self.assertEquals( [BaseMatrixAnim, 1, Matrix, Maker, 23, 32], [ type(pr.animation), len(pr.drivers), type(pr.layout), type(pr.maker), pr.layout.width, pr.layout.height, ])
def _project_simple(): desc = {'shape': 8, 'driver': 'dummy', 'run': {'threaded': True}} p = project.project(desc) p.start() _pause() return p, p.stop
def test_empty(self): project.project()
def test_empty(self): with patch.patch(defaults, 'BYPASS_PROJECT_DEFAULTS', True): with self.assertRaises(ValueError): project.project()