コード例 #1
0
ファイル: project2_test.py プロジェクト: ymz000/BiblioPixel
    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,
        ])
コード例 #2
0
    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,
            ])
コード例 #3
0
ファイル: make.py プロジェクト: wyojustin/BiblioPixel
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)
コード例 #4
0
    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,
        ])
コード例 #5
0
ファイル: make.py プロジェクト: ymz000/BiblioPixel
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)
コード例 #6
0
ファイル: make.py プロジェクト: ManiacalLabs/BiblioPixel
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)
コード例 #7
0
    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,
            ])
コード例 #8
0
def _project_simple():
    desc = {'shape': 8, 'driver': 'dummy', 'run': {'threaded': True}}
    p = project.project(desc)
    p.start()
    _pause()
    return p, p.stop
コード例 #9
0
 def test_empty(self):
     project.project()
コード例 #10
0
 def test_empty(self):
     with patch.patch(defaults, 'BYPASS_PROJECT_DEFAULTS', True):
         with self.assertRaises(ValueError):
             project.project()
コード例 #11
0
ファイル: project2_test.py プロジェクト: ymz000/BiblioPixel
 def test_empty(self):
     project.project()
コード例 #12
0
 def test_empty(self):
     with patch.patch(defaults, 'BYPASS_PROJECT_DEFAULTS', True):
         with self.assertRaises(ValueError):
             project.project()