def test_regex(self):
        self.map.put("key-1", "car")
        self.map.put("key-2", "cry")
        self.map.put("key-3", "giraffe")

        predicate = regex("this", "c[ar].*")

        self.assertCountEqual(self.map.key_set(predicate), ["key-1", "key-2"])
Exemple #2
0
 "LinkedList": [None, _non_null_list],
 "TruePredicate": predicate.true(),
 "FalsePredicate": predicate.false(),
 "SqlPredicate": predicate.sql(_sql_string),
 "EqualPredicate": predicate.equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
 "NotEqualPredicate": predicate.not_equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
 "GreaterLessPredicate": predicate.greater(_sql_string, REFERENCE_OBJECTS["Integer"]),
 "BetweenPredicate": predicate.between(
     _sql_string, REFERENCE_OBJECTS["Integer"], REFERENCE_OBJECTS["Integer"]
 ),
 "LikePredicate": predicate.like(_sql_string, _sql_string),
 "ILikePredicate": predicate.ilike(_sql_string, _sql_string),
 "InPredicate": predicate.in_(
     _sql_string, REFERENCE_OBJECTS["Integer"], REFERENCE_OBJECTS["Integer"]
 ),
 "RegexPredicate": predicate.regex(_sql_string, _sql_string),
 "AndPredicate": predicate.and_(
     predicate.sql(_sql_string),
     predicate.equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.not_equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.greater(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.greater_or_equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
 ),
 "OrPredicate": predicate.or_(
     predicate.sql(_sql_string),
     predicate.equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.not_equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.greater(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.greater_or_equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
 ),
 "InstanceOfPredicate": predicate.instance_of(
 "NotEqualPredicate":
 predicate.not_equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
 "GreaterLessPredicate":
 predicate.greater(_sql_string, REFERENCE_OBJECTS["Integer"]),
 "BetweenPredicate":
 predicate.between(_sql_string, REFERENCE_OBJECTS["Integer"],
                   REFERENCE_OBJECTS["Integer"]),
 "LikePredicate":
 predicate.like(_sql_string, _sql_string),
 "ILikePredicate":
 predicate.ilike(_sql_string, _sql_string),
 "InPredicate":
 predicate.in_(_sql_string, REFERENCE_OBJECTS["Integer"],
               REFERENCE_OBJECTS["Integer"]),
 "RegexPredicate":
 predicate.regex(_sql_string, _sql_string),
 "AndPredicate":
 predicate.and_(
     predicate.sql(_sql_string),
     predicate.equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.not_equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.greater(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.greater_or_equal(_sql_string, REFERENCE_OBJECTS["Integer"])),
 "OrPredicate":
 predicate.or_(
     predicate.sql(_sql_string),
     predicate.equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.not_equal(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.greater(_sql_string, REFERENCE_OBJECTS["Integer"]),
     predicate.greater_or_equal(_sql_string, REFERENCE_OBJECTS["Integer"])),
 "InstanceOfPredicate":
 def test_regex(self):
     predicate = regex("this", "c[ar].*")
     self.assertEqual(
         str(predicate),
         "RegexPredicate(attribute='this', pattern='c[ar].*')")