MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / compound

Class compound

lib/sqlalchemy/testing/exclusions.py:41–194  ·  lib/sqlalchemy/testing/exclusions.py::compound

Source from the content-addressed store, hash-verified

39
40
41class compound:
42 def __init__(self):
43 self.fails = set()
44 self.skips = set()
45 self.warns = {}
46
47 def __add__(self, other):
48 return self.add(other)
49
50 def as_skips(self):
51 rule = compound()
52 rule.skips.update(self.skips)
53 rule.skips.update(self.fails)
54 return rule
55
56 def add(self, *others):
57 copy = compound()
58 copy.fails.update(self.fails)
59 copy.skips.update(self.skips)
60 copy.warns.update(self.warns)
61
62 for other in others:
63 copy.fails.update(other.fails)
64 copy.skips.update(other.skips)
65 copy.warns.update(other.warns)
66 return copy
67
68 def not_(self):
69 copy = compound()
70 copy.fails.update(NotPredicate(fail) for fail in self.fails)
71 copy.skips.update(NotPredicate(skip) for skip in self.skips)
72 copy.warns.update(
73 {
74 NotPredicate(warn): element
75 for warn, element in self.warns.items()
76 }
77 )
78 return copy
79
80 @property
81 def enabled(self):
82 return self.enabled_for_config(config._current)
83
84 def enabled_for_config(self, config):
85 for predicate in self.skips.union(self.fails):
86 if predicate(config):
87 return False
88 else:
89 return True
90
91 def matching_warnings(self, config):
92 return [
93 message
94 for predicate, (message, assert_) in self.warns.items()
95 if predicate(config)
96 ]
97
98 def matching_config_reasons(self, config):

Callers 7

skip_ifFunction · 0.85
fails_ifFunction · 0.85
warns_ifFunction · 0.85
as_skipsMethod · 0.85
addMethod · 0.85
not_Method · 0.85
fail_ifMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected