コード例 #1
0
ファイル: tests.py プロジェクト: dipapaspyros/persona-builder
    def test_matches_named_scalar(self):
        p = Property(self.um, '^Ranges.from_float_value(10..20=L|20..30=M|30..40=H, 35)', None, tp='###')

        self.assertTrue(p.matches('L', '=L'))
        self.assertFalse(p.matches('L', '<L'))
        self.assertTrue(p.matches('H', '>L'))
        self.assertTrue(p.matches('M', '!=L'))
コード例 #2
0
    def test_matches_named_scalar(self):
        p = Property(
            self.um,
            '^Ranges.from_float_value(10..20=L|20..30=M|30..40=H, 35)',
            None,
            tp='###')

        self.assertTrue(p.matches('L', '=L'))
        self.assertFalse(p.matches('L', '<L'))
        self.assertTrue(p.matches('H', '>L'))
        self.assertTrue(p.matches('M', '!=L'))
コード例 #3
0
    def test_matches_string(self):
        p = Property(self.um, '^Person.first_name', None)

        self.assertTrue(p.matches('Nick', '=Nick'))
        self.assertFalse(p.matches('Nick', '=John'))

        self.assertFalse(p.matches('Nick', '!=Nick'))
        self.assertTrue(p.matches('Nick', '!=John'))

        # test quoted
        self.assertTrue(p.matches('Nick', '="Nick"'))
コード例 #4
0
ファイル: tests.py プロジェクト: dipapaspyros/persona-builder
    def test_matches_string(self):
        p = Property(self.um, '^Person.first_name', None)

        self.assertTrue(p.matches('Nick', '=Nick'))
        self.assertFalse(p.matches('Nick', '=John'))

        self.assertFalse(p.matches('Nick', '!=Nick'))
        self.assertTrue(p.matches('Nick', '!=John'))

        # test quoted
        self.assertTrue(p.matches('Nick', '="Nick"'))
コード例 #5
0
ファイル: tests.py プロジェクト: dipapaspyros/persona-builder
    def test_matches_scalar(self):
        p = Property(self.um, '^Ranges.from_float_value(10..20|20..30|30..40, 35)', None, tp='###')

        self.assertTrue(p.matches('10..20', '=10..20'))
        self.assertFalse(p.matches('10..20', '<10..20'))
        self.assertTrue(p.matches('20..30', '>10..20'))
        self.assertTrue(p.matches('20..30', '!=10..20'))

        # test wrong ranges
        with self.assertRaises(ValueError):
            self.assertTrue(p.matches('20..29', '>10..20'))

        with self.assertRaises(ValueError):
            self.assertTrue(p.matches('20..30', '!=10..15'))
コード例 #6
0
    def test_matches_scalar(self):
        p = Property(self.um,
                     '^Ranges.from_float_value(10..20|20..30|30..40, 35)',
                     None,
                     tp='###')

        self.assertTrue(p.matches('10..20', '=10..20'))
        self.assertFalse(p.matches('10..20', '<10..20'))
        self.assertTrue(p.matches('20..30', '>10..20'))
        self.assertTrue(p.matches('20..30', '!=10..20'))

        # test wrong ranges
        with self.assertRaises(ValueError):
            self.assertTrue(p.matches('20..29', '>10..20'))

        with self.assertRaises(ValueError):
            self.assertTrue(p.matches('20..30', '!=10..15'))