Skip to content

Commit 5a0096a

Browse files
committed
literals, literals everywhere
1 parent d7e25d7 commit 5a0096a

File tree

2 files changed

+234
-234
lines changed

2 files changed

+234
-234
lines changed

tests/unit/segments/fixtures.py

Lines changed: 119 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from flag_engine.context.types import SegmentContext, SegmentRule
1+
from flag_engine.context.types import SegmentContext
22
from flag_engine.segments import constants
33

44
trait_key_1 = "email"
@@ -10,141 +10,141 @@
1010
trait_key_3 = "date_joined"
1111
trait_value_3 = "2021-01-01"
1212

13-
empty_segment = SegmentContext(key=str(1), name="empty_segment", rules=[])
13+
empty_segment = {"key": "1", "name": "empty_segment", "rules": []}
1414

15-
segment_single_condition = SegmentContext(
16-
key=str(2),
17-
name="segment_one_condition",
18-
rules=[
19-
SegmentRule(
20-
type=constants.ALL_RULE,
21-
conditions=[
22-
dict(
23-
operator=constants.EQUAL,
24-
property=trait_key_1,
25-
value=trait_value_1,
26-
)
15+
segment_single_condition: SegmentContext = {
16+
"key": "2",
17+
"name": "segment_one_condition",
18+
"rules": [
19+
{
20+
"type": constants.ALL_RULE,
21+
"conditions": [
22+
{
23+
"operator": constants.EQUAL,
24+
"property": trait_key_1,
25+
"value": trait_value_1,
26+
}
2727
],
28-
)
28+
}
2929
],
30-
)
30+
}
3131

32-
segment_multiple_conditions_all = SegmentContext(
33-
key=str(3),
34-
name="segment_multiple_conditions_all",
35-
rules=[
36-
SegmentRule(
37-
type=constants.ALL_RULE,
38-
conditions=[
39-
dict(
40-
operator=constants.EQUAL,
41-
property=trait_key_1,
42-
value=trait_value_1,
43-
),
44-
dict(
45-
operator=constants.EQUAL,
46-
property=trait_key_2,
47-
value=trait_value_2,
48-
),
32+
segment_multiple_conditions_all: SegmentContext = {
33+
"key": "3",
34+
"name": "segment_multiple_conditions_all",
35+
"rules": [
36+
{
37+
"type": constants.ALL_RULE,
38+
"conditions": [
39+
{
40+
"operator": constants.EQUAL,
41+
"property": trait_key_1,
42+
"value": trait_value_1,
43+
},
44+
{
45+
"operator": constants.EQUAL,
46+
"property": trait_key_2,
47+
"value": trait_value_2,
48+
},
4949
],
50-
)
50+
}
5151
],
52-
)
52+
}
5353

54-
segment_multiple_conditions_any = SegmentContext(
55-
key=str(4),
56-
name="segment_multiple_conditions_all",
57-
rules=[
58-
SegmentRule(
59-
type=constants.ANY_RULE,
60-
conditions=[
61-
dict(
62-
operator=constants.EQUAL,
63-
property=trait_key_1,
64-
value=trait_value_1,
65-
),
66-
dict(
67-
operator=constants.EQUAL,
68-
property=trait_key_2,
69-
value=trait_value_2,
70-
),
54+
segment_multiple_conditions_any: SegmentContext = {
55+
"key": "4",
56+
"name": "segment_multiple_conditions_all",
57+
"rules": [
58+
{
59+
"type": constants.ANY_RULE,
60+
"conditions": [
61+
{
62+
"operator": constants.EQUAL,
63+
"property": trait_key_1,
64+
"value": trait_value_1,
65+
},
66+
{
67+
"operator": constants.EQUAL,
68+
"property": trait_key_2,
69+
"value": trait_value_2,
70+
},
7171
],
72-
)
72+
}
7373
],
74-
)
74+
}
7575

76-
segment_nested_rules = SegmentContext(
77-
key=str(5),
78-
name="segment_nested_rules_all",
79-
rules=[
80-
SegmentRule(
81-
type=constants.ALL_RULE,
82-
rules=[
83-
SegmentRule(
84-
type=constants.ALL_RULE,
85-
conditions=[
86-
dict(
87-
operator=constants.EQUAL,
88-
property=trait_key_1,
89-
value=trait_value_1,
90-
),
91-
dict(
92-
operator=constants.EQUAL,
93-
property=trait_key_2,
94-
value=trait_value_2,
95-
),
76+
segment_nested_rules: SegmentContext = {
77+
"key": "5",
78+
"name": "segment_nested_rules_all",
79+
"rules": [
80+
{
81+
"type": constants.ALL_RULE,
82+
"rules": [
83+
{
84+
"type": constants.ALL_RULE,
85+
"conditions": [
86+
{
87+
"operator": constants.EQUAL,
88+
"property": trait_key_1,
89+
"value": trait_value_1,
90+
},
91+
{
92+
"operator": constants.EQUAL,
93+
"property": trait_key_2,
94+
"value": trait_value_2,
95+
},
9696
],
97-
),
98-
SegmentRule(
99-
type=constants.ALL_RULE,
100-
conditions=[
101-
dict(
102-
operator=constants.EQUAL,
103-
property=trait_key_3,
104-
value=trait_value_3,
105-
)
97+
},
98+
{
99+
"type": constants.ALL_RULE,
100+
"conditions": [
101+
{
102+
"operator": constants.EQUAL,
103+
"property": trait_key_3,
104+
"value": trait_value_3,
105+
}
106106
],
107-
),
107+
},
108108
],
109-
)
109+
}
110110
],
111-
)
111+
}
112112

113-
segment_conditions_and_nested_rules = SegmentContext(
114-
key=str(6),
115-
name="segment_multiple_conditions_all_and_nested_rules",
116-
rules=[
117-
SegmentRule(
118-
type=constants.ALL_RULE,
119-
conditions=[
120-
dict(
121-
operator=constants.EQUAL,
122-
property=trait_key_1,
123-
value=trait_value_1,
124-
)
113+
segment_conditions_and_nested_rules: SegmentContext = {
114+
"key": "6",
115+
"name": "segment_multiple_conditions_all_and_nested_rules",
116+
"rules": [
117+
{
118+
"type": constants.ALL_RULE,
119+
"conditions": [
120+
{
121+
"operator": constants.EQUAL,
122+
"property": trait_key_1,
123+
"value": trait_value_1,
124+
}
125125
],
126-
rules=[
127-
SegmentRule(
128-
type=constants.ALL_RULE,
129-
conditions=[
130-
dict(
131-
operator=constants.EQUAL,
132-
property=trait_key_2,
133-
value=trait_value_2,
134-
),
126+
"rules": [
127+
{
128+
"type": constants.ALL_RULE,
129+
"conditions": [
130+
{
131+
"operator": constants.EQUAL,
132+
"property": trait_key_2,
133+
"value": trait_value_2,
134+
},
135135
],
136-
),
137-
SegmentRule(
138-
type=constants.ALL_RULE,
139-
conditions=[
140-
dict(
141-
operator=constants.EQUAL,
142-
property=trait_key_3,
143-
value=trait_value_3,
144-
)
136+
},
137+
{
138+
"type": constants.ALL_RULE,
139+
"conditions": [
140+
{
141+
"operator": constants.EQUAL,
142+
"property": trait_key_3,
143+
"value": trait_value_3,
144+
}
145145
],
146-
),
146+
},
147147
],
148-
)
148+
}
149149
],
150-
)
150+
}

0 commit comments

Comments
 (0)