<commit_before># *****************************************************************************
# Copyright (c) 2019 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
# *****************************************************************************
#
import uuid
from datetime import datetime
import testUtils
import time
import pytest
from wiotp.sdk.exceptions import ApiException
import string
import json


@testUtils.oneJobOnlyTest
class TestRules(testUtils.AbstractTest):

    testLISchemaName = "python-api-test-li-schema"

    testLISchema = {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "title": "Environment Sensor Schema",
        "properties": {
            "temperature": {
                "description": "temperature in degrees Celsius",
                "type": "number",
                "minimum": -237.15,
                "default": 0.0,
            },
            "humidity": {"description": "relative humidity (%)", "type": "number", "minimum": 0.0, "default": 0.0},
            "publishTimestamp": {"description": "publishTimestamp", "type": "number", "minimum": 0.0, "default": 0.0},
        },
        "required": ["temperature", "humidity", "publishTimestamp"],
    }

    testLogicalInterfaceName = "python-api-test-logicalInterface"

    testRuleName = "python-api-test-rule"
    updatedTestRuleName = "python-api-test-rule-updated"

    # =========================================================================
    # Set up services
    # =========================================================================
    def testCleanup(self):
        for r in self.appClient.state.draft.rules:
            if r.name in (TestRules.testRuleName, TestRules.updatedTestRuleName):
                print("Deleting old rule instance: %s" % (r))
                rules = self.appClient.state.draft.logicalinterfaces[r.logicalInterfaceId].rules
                del rules[r.id]

        for li in self.appClient.state.draft.logicalInterfaces:
            if li.name == TestRules.testLogicalInterfaceName:<commit_msg>correct test typo - caused "no attribute found" when preexisting rules exist<commit_after># *****************************************************************************
# Copyright (c) 2019 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
# *****************************************************************************
#
import uuid
from datetime import datetime
import testUtils
import time
import pytest
from wiotp.sdk.exceptions import ApiException
import string
import json


@testUtils.oneJobOnlyTest
class TestRules(testUtils.AbstractTest):

    testLISchemaName = "python-api-test-li-schema"

    testLISchema = {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "title": "Environment Sensor Schema",
        "properties": {
            "temperature": {
                "description": "temperature in degrees Celsius",
                "type": "number",
                "minimum": -237.15,
                "default": 0.0,
            },
            "humidity": {"description": "relative humidity (%)", "type": "number", "minimum": 0.0, "default": 0.0},
            "publishTimestamp": {"description": "publishTimestamp", "type": "number", "minimum": 0.0, "default": 0.0},
        },
        "required": ["temperature", "humidity", "publishTimestamp"],
    }

    testLogicalInterfaceName = "python-api-test-logicalInterface"

    testRuleName = "python-api-test-rule"
    updatedTestRuleName = "python-api-test-rule-updated"

    # =========================================================================
    # Set up services
    # =========================================================================
    def testCleanup(self):
        for r in self.appClient.state.draft.rules:
            if r.name in (TestRules.testRuleName, TestRules.updatedTestRuleName):
                print("Deleting old rule instance: %s" % (r))
                rules = self.appClient.state.draft.logicalInterfaces[r.logicalInterfaceId].rules
                del rules[r.id]

        for li in self.appClient.state.draft.logicalInterfaces:
            if li.name == TestRules.testLogicalInterfaceName:
{'fraction_non_alphanumeric': 0.23415154749199574, 'fraction_numerical': 0.010672358591248666, 'mean_word_length': 3.3348751156336727, 'pattern_counts': {'":': 40, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '96245', 'n_tokens_mistral': 1260, 'n_tokens_neox': 1163, 'n_words': 301}