def setUp(self):
        self.maxDiff = None
        self.td1 = TrainDescription(
            train_name='test_train',
            train_version='1.0',
            properties={
                1: url_by_name('FOO'),
                2: token_by_name('BAR'),
                3: enum_by_name('BAZ', choices=['VALUE1', 'VALUE2'])
            },
            formulas=[ConjunctiveNormalForm(Clause(1))],
            model_summary='model summary',
            algorithm_requirement=FormulaAlgorithmRequirement(1))

        self.td2 = TrainDescription(
            train_name='test_train',
            train_version='1.0',
            properties={
                1: url_by_name('FOO'),
                2: token_by_name('BAR'),
                3: enum_by_name('BAZ', choices=['VALUE1', 'VALUE2'])
            },
            formulas=[ConjunctiveNormalForm(Clause(1))],
            model_summary='model summary',
            algorithm_requirement=None)

        self.td3 = TrainDescription(
            train_name='test_train',
            train_version='1.0',
            properties={
                1: url_by_name('FOO'),
                2: token_by_name('BAR'),
                3: enum_by_name('BAZ', choices=['VALUE1', 'VALUE2'])
            },
            formulas=[
                ConjunctiveNormalForm(
                    Clause(1), Clause(-2, 1, 3), Clause(3, 1, -2, -3)
                ),
                ConjunctiveNormalForm(
                    Clause(3, 1), Clause(2, 1, 3, -3)
                ),
                ConjunctiveNormalForm(
                    Clause(-1)
                )
            ],
            model_summary='model summary',
            algorithm_requirement=FormulaAlgorithmRequirement(3))
 def test_invalid_train_description_3(self):
     self.assertValueError(lambda: TrainDescription(
         train_name='foo',
         train_version='1.0',
         properties={
             -1: url_by_name('FOO'),
             2: token_by_name('BAR'),
             3: enum_by_name('BAZ', choices=['VALUE1', 'VALUE2'])
         },
         formulas=[],
         model_summary='model summary',
         algorithm_requirement=None))
Example #3
0
 def test_eq_4(self):
     self.assertIsEqual(self.token4, token_by_name('SOME_OTHER_VARIABLE'))
Example #4
0
 def setUp(self):
     self.token1 = token_by_name('FOO')
     self.token2 = token_by_name('BAR')
     self.token3 = token_by_name('MY_VARIABLE')
     self.token4 = token_by_name('SOME_OTHER_VARIABLE')
Example #5
0
 def test_eq_2(self):
     self.assertIsEqual(self.token2, token_by_name('BAR'))
Example #6
0
 def test_eq_3(self):
     self.assertIsEqual(self.token3, token_by_name('MY_VARIABLE'))
Example #7
0
 def test_valid_error_2(self):
     self.assertTypeError(lambda: token_by_name(None))
Example #8
0
 def test_eq_1(self):
     self.assertIsEqual(self.token1, token_by_name('FOO'))
Example #9
0
 def test_valid_error_1(self):
     self.assertValueError(lambda: token_by_name('adaf'))
Example #10
0
 def test_type_error_5(self):
     self.assertTypeError(lambda: token_by_name(0.9661))
Example #11
0
 def test_type_error_3(self):
     self.assertTypeError(lambda: token_by_name([]))
Example #12
0
 def test_type_error_1(self):
     self.assertTypeError(lambda: token_by_name(True))
Example #13
0
 def assert_invalid_env_name(self, name):
     with self.assertRaises(ValueError):
         token_by_name(name)