Exemple #1
0
def has_features(*args):
    """Tests whether a list of features is a subset of the compiled-in features"""

    if len(args) == 1 and not isinstance(args[0], str) and hasattr(
            args[0], "__iter__"):
        check_set = set(args[0])
    else:
        check_set = set(args)

    if not check_set < all_features():
        raise RuntimeError("'{}' is not a feature".format(
            ','.join(check_set - all_features())))

    return check_set < set(features())
Exemple #2
0
    def test_has_features(self):
        for feature in code_info.features():
            self.assertTrue(has_features(feature))

        for feature in code_info.all_features() - set(code_info.features()):
            self.assertFalse(has_features(feature))

        with self.assertRaises(RuntimeError) as _:
            has_features("NotAFeature")