> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deasylabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Test Cases

> Generate test cases for regex pattern validation.

Creates both positive (should match) and negative (should NOT match) test cases
to help users validate their regex patterns.

Attributes:
    pattern_descriptions: List of descriptions of what patterns should match.
    existing_patterns: Optional existing regex patterns to test against.



## OpenAPI

````yaml /deasy-openapi-stainless.yml post /generate_test_cases
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: /rest/unstructured
security: []
paths:
  /generate_test_cases:
    post:
      tags:
        - Tags
      summary: Generate Test Cases
      description: >-
        Generate test cases for regex pattern validation.


        Creates both positive (should match) and negative (should NOT match)
        test cases

        to help users validate their regex patterns.


        Attributes:
            pattern_descriptions: List of descriptions of what patterns should match.
            existing_patterns: Optional existing regex patterns to test against.
      operationId: generate_test_cases_generate_test_cases_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateTestCasesRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateTestCasesResponse'
        '403':
          description: Missing token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '500':
          description: >-
            Internal Server Error. An unexpected error occurred while processing
            the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
      security:
        - BasicAuth: []
        - BearerAuth: []
          UserIdAuth: []
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from unstructured import UnstructuredClient

            client = UnstructuredClient(
                username=os.environ.get("UNSTRUCTURED_USERNAME"),  # This is the default and can be omitted
                password=os.environ.get("UNSTRUCTURED_PASSWORD"),  # This is the default and can be omitted
            )
            response = client.tags.pattern.generate_test_cases(
                pattern_descriptions=["string"],
            )
            print(response.test_cases)
        - lang: JavaScript
          source: >-
            import UnstructuredClient from 'unstructured-sdk';


            const client = new UnstructuredClient({
              authMethod: 'My Auth Method',
              username: process.env['UNSTRUCTURED_USERNAME'], // This is the default and can be omitted
              password: process.env['UNSTRUCTURED_PASSWORD'], // This is the default and can be omitted
            });


            const response = await client.tags.pattern.generateTestCases({
            pattern_descriptions: ['string'] });


            console.log(response.test_cases);
components:
  schemas:
    GenerateTestCasesRequest:
      properties:
        pattern_descriptions:
          items:
            type: string
          type: array
          title: Pattern Descriptions
        existing_patterns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Existing Patterns
          default: []
        tag_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Tag Name
        tag_description:
          anyOf:
            - type: string
            - type: 'null'
          title: Tag Description
        available_values:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Available Values
          default: []
        existing_positive_examples:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Existing Positive Examples
          default: []
        existing_negative_examples:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Existing Negative Examples
          default: []
        output_values:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Output Values
          default: []
        context_keywords:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Context Keywords
          default: []
      type: object
      required:
        - pattern_descriptions
      title: GenerateTestCasesRequest
    GenerateTestCasesResponse:
      properties:
        test_cases:
          items:
            $ref: '#/components/schemas/TestCase'
          type: array
          title: Test Cases
      type: object
      required:
        - test_cases
      title: GenerateTestCasesResponse
    HTTPError:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: HTTPError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TestCase:
      properties:
        text:
          type: string
          title: Text
        should_match:
          type: boolean
          title: Should Match
        category:
          type: string
          title: Category
        actual_match:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Actual Match
        validated:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Validated
        expected_value:
          anyOf:
            - type: string
            - type: 'null'
          title: Expected Value
      type: object
      required:
        - text
        - should_match
        - category
      title: TestCase
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
    BearerAuth:
      type: http
      scheme: bearer
    UserIdAuth:
      type: apiKey
      in: header
      name: X-User-ID

````