type: test/samples
schema_version: 1
test:
  suites:
  - name: "Analyzing Entity Sentiment [code sample tests]"
    cases:

    - name: language_entity_sentiment_text - Analyzing Entity Sentiment of a text string (default value)
      spec:
      # Default value: "Grapes are good. Bananas are bad."
      - call: {sample: language_entity_sentiment_text}
      - assert_contains:
        - {literal: "Representative name for the entity: Grapes"}
        - {literal: "Entity sentiment score: 0."}
        - {literal: "Representative name for the entity: Bananas"}
        - {literal: "Entity sentiment score: -0."}
        - {literal: "Entity sentiment magnitude: 0."}
        - {literal: "Language of the text: en"}

    - name: language_entity_sentiment_text - Analyzing Entity Sentiment of a text string (*custom value*)
      spec:
      # Custom value: "Grapes are actually not very good. But Bananas are great."
      - call:
          sample: language_entity_sentiment_text
          params:
            text_content: {literal: "Grapes are actually not very good. But Bananas are great."}
      - assert_contains:
        - {literal: "Representative name for the entity: Grapes"}
        - {literal: "Entity sentiment score: -0."}
        - {literal: "Representative name for the entity: Bananas"}
        - {literal: "Entity sentiment score: 0."}
        - {literal: "Entity sentiment magnitude: 0."}
        - {literal: "Language of the text: en"}

    - name: language_entity_sentiment_gcs - Analyzing Entity Sentiment of text file in GCS (default value)
      spec:
      # Default value: gs://cloud-samples-data/language/entity-sentiment.txt
      # => "Grapes are good. Bananas are bad."
      - call: {sample: language_entity_sentiment_gcs}
      - assert_contains:
        - {literal: "Representative name for the entity: Grapes"}
        - {literal: "Entity sentiment score: -0."}
        - {literal: "Representative name for the entity: Bananas"}
        - {literal: "Entity sentiment score: 0."}
        - {literal: "Entity sentiment magnitude: 0."}
        - {literal: "Language of the text: en"}

    - name: language_entity_sentiment_gcs - Analyzing Entity Sentiment of text file in GCS (*custom value*)
      spec:
      # Use different file: gs://cloud-samples-data/language/entity-sentiment-reverse.txt
      # => "Grapes are actually not very good. But Bananas are great."
      - call:
          sample: language_entity_sentiment_gcs
          params:
            gcs_content_uri:
              literal: "gs://cloud-samples-data/language/entity-sentiment-reverse.txt"
      - assert_contains:
        - {literal: "Representative name for the entity: Grapes"}
        - {literal: "Entity sentiment score: -0."}
        - {literal: "Representative name for the entity: Bananas"}
        - {literal: "Entity sentiment score: 0."}
        - {literal: "Entity sentiment magnitude: 0."}
        - {literal: "Language of the text: en"}
