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

# config_parser_test.py

## High-level description

This file contains unit tests for the config parsing functionality of the cassiopeia\_preprocess pipeline. It tests the parsing of configuration files, the creation of pipeline stages, and the handling of various configuration scenarios.

## Code Structure

The main class `TestCollapseUMIs` inherits from `unittest.TestCase` and contains several test methods. The `setUp` method initializes test data, including different configuration scenarios. The test methods then use this data to verify the correct behavior of the config parsing and pipeline setup functions.

## Symbols

### TestCollapseUMIs

#### Description

A test class that inherits from `unittest.TestCase`, containing methods to test the configuration parsing and pipeline setup for the cassiopeia\_preprocess pipeline.

#### Internal Logic

1. Sets up test data in the `setUp` method, including various configuration scenarios.
2. Tests the parsing of a valid configuration file.
3. Tests the handling of an unspecified configuration parameter.
4. Tests the correct setup of the full pipeline.
5. Tests the correct setup of a subset pipeline.

### TestCollapseUMIs.setUp

#### Description

Initializes test data for the test cases, including different configuration scenarios.

#### Internal Logic

1. Creates a basic configuration dictionary and its string representation.
2. Creates a subset configuration dictionary and its string representation.
3. Creates a failure configuration dictionary and its string representation.

### TestCollapseUMIs.test\_read\_good\_config

#### Description

Tests the parsing of a valid configuration file.

#### Internal Logic

1. Parses the basic configuration string.
2. Checks that default parameters are set correctly.
3. Verifies that specified parameters are updated correctly.
4. Ensures that output directories are set for various pipeline stages.

### TestCollapseUMIs.test\_unspecified\_config\_raises\_error

#### Description

Tests that an error is raised when an unspecified configuration parameter is encountered.

#### Internal Logic

1. Attempts to parse the failure configuration string.
2. Asserts that a `UnspecifiedConfigParameterError` is raised.

### TestCollapseUMIs.test\_pipeline\_setup\_correct

#### Description

Tests the correct setup of the full pipeline.

#### Internal Logic

1. Parses the basic configuration string.
2. Creates the pipeline using the entry and exit points from the configuration.
3. Compares the created pipeline stages with the expected stages.

### TestCollapseUMIs.test\_subset\_pipeline\_setup\_correct

#### Description

Tests the correct setup of a subset pipeline.

#### Internal Logic

1. Parses the subset configuration string.
2. Creates the pipeline using the entry and exit points from the configuration.
3. Compares the created pipeline stages with the expected subset of stages.

## Dependencies

| Dependency | Purpose |
| :- | :- |
| unittest | Provides the testing framework |
| pandas | Used for data manipulation (imported but not used in the test file) |
| cassiopeia.preprocess.cassiopeia\_preprocess | Contains the main pipeline logic |
| cassiopeia.preprocess.constants | Contains constants used in the pipeline |
| cassiopeia.preprocess.setup\_utilities | Provides utility functions for setting up the pipeline |

## Error Handling

The test cases check for proper error handling, specifically testing that a `UnspecifiedConfigParameterError` is raised when an unspecified configuration parameter is encountered.

This test file ensures that the configuration parsing and pipeline setup functionality of the cassiopeia\_preprocess pipeline works correctly under various scenarios, including full pipeline setup, subset pipeline setup, and handling of configuration errors.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.