Beispiel #1
0
    def test_removeRule(self):
        n.addRule('test', 'category', 'function', 'digits', 'type')
        result = n.removeRule('test')
        self.assertTrue(result)

        result = n.removeRule('test2')
        self.assertFalse(result)
Beispiel #2
0
 def test_active(self):
     pattern = '{category}_{function}_{digits}_{type}'
     n.addRule('lights', 'category', 'function', 'whatAffects', 'digits',
               'type')
     n.addRule('test', 'category', 'function', 'digits', 'type')
     n.setActiveRule('test')
     result = n.getActiveRule()
     self.assertIsNotNone(result)
Beispiel #3
0
    def test_save_load_rule(self):
        n.addRule('test', 'category', 'function', 'whatAffects', 'digits',
                  'type')
        filepath = tempfile.mktemp()
        n.saveRule('test', filepath)

        n.resetRules()
        n.loadRule(filepath)
        self.assertTrue(n.hasRule('test'))
Beispiel #4
0
 def setUp(self):
     n.resetTokens()
     n.addToken('whatAffects')
     n.addTokenNumber('number')
     n.addToken('category',
                natural='natural',
                practical='practical',
                dramatic='dramatic',
                volumetric='volumetric',
                default='natural')
     n.addToken('function',
                key='key',
                fill='fill',
                ambient='ambient',
                bounce='bounce',
                rim='rim',
                kick='kick',
                default='custom')
     n.addToken('type', lighting='LGT', default='LGT')
     n.addRule('lights', 'category', 'function', 'whatAffects', 'number',
               'type')
     return super(NumberTokenCase, self).setUp()
Beispiel #5
0
 def test_validation(self):
     token = n.addToken('function',
                        key='key',
                        fill='fill',
                        ambient='ambient',
                        bounce='bounce',
                        rim='rim',
                        kick='kick',
                        default='custom')
     rule = n.addRule('lights', 'category', 'function', 'whatAffects',
                      'digits', 'type')
     self.assertIsNone(n.Rule.fromData(token.data()))
     self.assertIsNone(n.Token.fromData(rule.data()))
Beispiel #6
0
    def test_save_load_session(self):
        n.addToken('whatAffects')
        n.addTokenNumber('digits')
        n.addToken('category',
                   natural='natural',
                   practical='practical',
                   dramatic='dramatic',
                   volumetric='volumetric',
                   default='natural')
        n.addToken('function',
                   key='key',
                   fill='fill',
                   ambient='ambient',
                   bounce='bounce',
                   rim='rim',
                   kick='kick',
                   default='custom')
        n.addToken('type', lighting='LGT', animation='ANI', default='LGT')
        n.addRule('lights', 'category', 'function', 'whatAffects', 'digits',
                  'type')
        n.addRule('test', 'category', 'function')
        n.setActiveRule('lights')

        repo = tempfile.mkdtemp()
        n.saveSession(repo)

        n.resetRules()
        n.resetTokens()

        n.loadSession(repo)
        self.assertTrue(n.hasToken('whatAffects'))
        self.assertTrue(n.hasToken('digits'))
        self.assertTrue(n.hasToken('category'))
        self.assertTrue(n.hasToken('function'))
        self.assertTrue(n.hasToken('type'))
        self.assertTrue(n.hasRule('lights'))
        self.assertTrue(n.hasRule('test'))
        self.assertEqual(n.getActiveRule().name, 'lights')
from __future__ import absolute_import
import os
import cgxLightingTools.scripts.core.namingConventions as n

repoPath = os.path.join(os.path.dirname(os.path.abspath(n.__file__)), 'cfg')
os.environ['NAMING_REPO'] = repoPath

n.addToken('whatAffects')
n.addTokenNumber('number')
n.addToken('category',
           natural='nat',
           practical='pra',
           dramatic='dra',
           volumetric='vol',
           default='nat')
n.addToken('function',
           key='key',
           fill='fil',
           ambient='amb',
           bounce='bnc',
           rim='rim',
           kick='kik',
           custom='cst',
           default='cst')
n.addRule('lights', 'category', 'function', 'number', 'whatAffects')

n.saveSession()
Beispiel #8
0
 def test_rules(self):
     rule1 = n.addRule('lights', 'category', 'function', 'whatAffects',
                       'digits', 'type')
     rule2 = n.Rule.fromData(rule1.data())
     self.assertEqual(rule1.data(), rule2.data())
Beispiel #9
0
 def test_add(self):
     result = n.addRule('lights', 'category', 'function', 'whatAffects',
                        'digits', 'type')
     self.assertTrue(result)