<commit_before>"""Definitions of tests for component metadata stored in the AWS S3 database."""
from behave import given, then, when
from src.attribute_checks import *
from src.s3interface import *
from src.utils import split_comma_separated_list
import boto3
import botocore
import time


@then('I should find the correct component core data for package {package} version {version} '
      'from ecosystem {ecosystem}')
@then('I should find the correct component toplevel metadata for package {package:S} '
      'version {version:S} ecosystem {ecosystem:S} with latest version {version2:S}')
def check_component_core_data(context, package, version, ecosystem, version2=None):
    """Check the component core data read from the AWS S3 database.

    Expected format (with an example data):
        {
          "analyses": [
            "security_issues",
            "metadata",
            "keywords_tagging",
            "digests",
            "source_licenses",
            "dependency_snapshot"
          ],
          "audit": null,
          "dependents_count": -1,<commit_msg>(Minor) better wording for existing test step<commit_after>"""Definitions of tests for component metadata stored in the AWS S3 database."""
from behave import given, then, when
from src.attribute_checks import *
from src.s3interface import *
from src.utils import split_comma_separated_list
import boto3
import botocore
import time


@then('I should find the correct component core data for package {package} version {version} '
      'from ecosystem {ecosystem}')
@then('I should find the correct component toplevel metadata for package {package:S} '
      'version {version:S} ecosystem {ecosystem:S} with latest version {version2:S}')
@then('I should find the correct component toplevel metadata for package {package:S} '
      'version {version:S} from ecosystem {ecosystem:S} with latest version {version2:S}')
def check_component_core_data(context, package, version, ecosystem, version2=None):
    """Check the component core data read from the AWS S3 database.

    Expected format (with an example data):
        {
          "analyses": [
            "security_issues",
            "metadata",
            "keywords_tagging",
            "digests",
            "source_licenses",
            "dependency_snapshot"
          ],
          "audit": null,
          "dependents_count": -1,
{'fraction_non_alphanumeric': 0.09048821548821549, 'fraction_numerical': 0.006313131313131313, 'mean_word_length': 3.321818181818182, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2400669', 'n_tokens_mistral': 640, 'n_tokens_neox': 623, 'n_words': 231}