Skip to content

Commit

Permalink
Used .name instead of needing a feature string mapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesharrow committed Aug 28, 2024
1 parent 0245436 commit e601967
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/python_testing/TC_DEMTestBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@

logger = logging.getLogger(__name__)

s_feature_strs = {Clusters.DeviceEnergyManagement.Bitmaps.Feature.kPowerAdjustment: "kPowerAdjustment",
Clusters.DeviceEnergyManagement.Bitmaps.Feature.kPowerForecastReporting: "kPowerForecastReporting",
Clusters.DeviceEnergyManagement.Bitmaps.Feature.kStateForecastReporting: "kStateForecastReporting",
Clusters.DeviceEnergyManagement.Bitmaps.Feature.kStartTimeAdjustment: "kStartTimeAdjustment",
Clusters.DeviceEnergyManagement.Bitmaps.Feature.kPausable: "kPausable",
Clusters.DeviceEnergyManagement.Bitmaps.Feature.kForecastAdjustment: "kForecastAdjustment",
Clusters.DeviceEnergyManagement.Bitmaps.Feature.kConstraintBasedAdjustment: "kConstraintBasedAdjustment"}


class DEMTestBase:

Expand All @@ -50,11 +42,11 @@ async def validate_feature_map(self, must_have_features, must_not_have_features)
feature_map = await self.read_dem_attribute_expect_success(attribute="FeatureMap")
for must_have_feature in must_have_features:
asserts.assert_true(feature_map & must_have_feature,
f"{s_feature_strs[must_have_feature]} must be set but is not. feature_map 0x{feature_map:x}")
f"{must_have_feature.name} must be set but is not. feature_map 0x{feature_map:x}")

for must_not_have_feature in must_not_have_features:
asserts.assert_false(feature_map & must_not_have_feature,
f"{s_feature_strs[must_not_have_feature]} is not allowed to be set. feature_map 0x{feature_map:x}")
f"{must_not_have_feature.name} is not allowed to be set. feature_map 0x{feature_map:x}")

async def validate_pfr_or_sfr_in_feature_map(self):
feature_map = await self.read_dem_attribute_expect_success(attribute="FeatureMap")
Expand Down

0 comments on commit e601967

Please sign in to comment.