Skip to content

Commit bee5d81

Browse files
committed
Variants are case sensitive
1 parent b64b2e6 commit bee5d81

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

posthog/feature_flags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ def matches_dependency_value(expected_value, actual_value):
189189
# Any variant matches boolean true
190190
return expected_value
191191
elif isinstance(expected_value, str):
192-
# String comparison (case-insensitive to match C# StringComparison.OrdinalIgnoreCase)
193-
return actual_value.lower() == expected_value.lower()
192+
# variants are case-sensitive, hence our comparison is too
193+
return actual_value == expected_value
194194
else:
195195
return False
196196

posthog/test/test_feature_flags.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,10 +2074,11 @@ def test_matches_dependency_value(self):
20742074
"""Test the matches_dependency_value function logic"""
20752075
from posthog.feature_flags import matches_dependency_value
20762076

2077-
# String variant matches string exactly (case-insensitive)
2077+
# String variant matches string exactly (case-sensitive)
20782078
self.assertTrue(matches_dependency_value("control", "control"))
2079-
self.assertTrue(matches_dependency_value("control", "Control"))
2080-
self.assertTrue(matches_dependency_value("control", "CONTROL"))
2079+
self.assertTrue(matches_dependency_value("Control", "Control"))
2080+
self.assertFalse(matches_dependency_value("control", "Control"))
2081+
self.assertFalse(matches_dependency_value("Control", "CONTROL"))
20812082
self.assertFalse(matches_dependency_value("control", "test"))
20822083

20832084
# String variant matches boolean true (any variant is truthy)

0 commit comments

Comments
 (0)