← Capital One Interview Insights

Capital One·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Capital One data scientist tech round centered on unit testing an existing class. Three-part question that escalated from reading comprehension to writing actual pytest code, which is not what I expected from a DS interview.

Questions Asked (3)

Q1

Looking at the provided unit test, what does it actually validate? Walk through what the test is checking.

Technical Trade-offsRoot Cause Analysis
Author's notes

Easier than it sounds but also kind of a trap for overconfidence.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by restating the test's purpose in plain language, then walk through the arrange-act-assert structure to show what inputs, operations, and expected outputs are being validated. Finally, assess whether the test covers the intended behavior, edge cases, and any gaps that could hide bugs.

Pro tip: Point out what the test does NOT validate—such as missing edge cases, untested error handling, or assumptions about data shape—because that shows you think like a senior data scientist who evaluates test quality, not just test mechanics.

1. Identify the test's intent

State in one sentence what behavior or function the test is meant to verify, based on its name, docstring, and assertions. This frames the rest of your walkthrough.

2. Break down the arrange-act-assert

Describe the setup (fixtures, mock data, inputs), the action (function call or method under test), and the assertion (expected output, exception, or side effect). This shows you can read code systematically.

3. Map assertions to expected behavior

Explain what each assertion actually checks—equality, type, shape, value range, or error—and whether it aligns with the function's contract. Highlight any weak or overly broad assertions.

4. Evaluate coverage and gaps

Discuss what the test covers well and what it misses, such as edge cases, invalid inputs, boundary conditions, or integration points. This demonstrates critical thinking about test quality.

5. Connect to real-world impact

Explain how the test's scope affects confidence in the code, especially for a data science context where data drift, nulls, or schema changes can break assumptions.

Key Points to Mention

  • Arrange-act-assert structure and how each part maps to the test's logic
  • Specific assertions: what is compared, expected types, shapes, or values
  • Mocking or fixtures used and whether they realistically represent production data
  • Edge cases and error conditions the test does or does not cover
  • Whether the test validates behavior or just implementation details
  • Potential false confidence from passing tests that miss critical scenarios

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What additional test scenarios would you add to this test suite, and why would each one matter?

Technical Trade-offsRoot Cause Analysis
Author's notes

This is where I actually felt okay.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the purpose and scope of the existing test suite, then propose additional scenarios that target edge cases, data quality, model robustness, and business impact. For each scenario, explain why it matters in the context of Capital One's data science work, emphasizing risk mitigation and regulatory compliance.

Pro tip: Tie each test scenario to a specific business risk or regulatory requirement (e.g., fair lending, model drift) to show you understand the stakes beyond technical correctness.

1. Clarify the current test suite

Ask questions to understand what is already covered, such as data validation, model performance, and edge cases. This ensures your suggestions are additive and relevant.

2. Identify gaps and risks

Consider potential failure points: data drift, missing values, outliers, bias, and adversarial inputs. Prioritize scenarios based on likelihood and impact.

3. Propose specific scenarios

For each gap, suggest a concrete test scenario. For example, test model performance on out-of-time data, or simulate missing sensitive attributes.

4. Explain why each matters

Connect each scenario to business outcomes: regulatory compliance, customer experience, financial loss, or model reliability.

5. Prioritize and summarize

Rank the scenarios by importance and summarize how they collectively strengthen the test suite.

Key Points to Mention

  • Data drift and concept drift detection
  • Fairness and bias testing across protected groups
  • Robustness to missing or corrupted data
  • Out-of-time and out-of-distribution validation
  • Model interpretability and explainability checks
  • Regulatory compliance (e.g., SR 11-7, fair lending)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Pick the single most critical missing test scenario and write the actual pytest code for it.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Went with the null input case because it felt like the most likely real-world failure and the easiest to argue for.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the function or model under test and its expected behavior, then systematically identify edge cases and failure modes to pinpoint the most critical missing scenario. Prioritize scenarios that could cause silent failures or incorrect business decisions, and write a focused pytest that asserts the correct behavior with clear setup and teardown.

Pro tip: Choose a scenario that tests a boundary condition or data quality issue, as these are often overlooked but can have outsized impact in production. In your pytest, use parametrization or fixtures to make the test reusable and demonstrate awareness of maintainability.

1. Clarify the function and its contract

Ask questions to understand the function's purpose, inputs, outputs, and expected behavior under normal and abnormal conditions. Identify any assumptions or dependencies.

2. Brainstorm potential test scenarios

List all possible scenarios: happy path, edge cases (empty input, nulls, extremes), error conditions, and data quality issues. Consider business impact and likelihood of occurrence.

3. Prioritize the most critical missing scenario

Evaluate each scenario based on risk (e.g., silent failure, financial loss, regulatory impact) and select the one that is both missing and most critical. Justify your choice briefly.

4. Write the pytest code

Implement a clear, self-contained test using pytest idioms: use fixtures for setup, assert expected outcomes, and include a descriptive test name. Ensure the test fails without the fix and passes with it.

5. Explain the test and its value

Walk through the test logic, why this scenario matters, and how it integrates with the existing test suite. Mention any trade-offs or additional tests you would add.

Key Points to Mention

  • Boundary value analysis and equivalence partitioning to identify edge cases
  • Data quality checks (e.g., missing values, outliers, type mismatches) specific to data science
  • Business impact and risk assessment to prioritize scenarios
  • Use of pytest fixtures, parametrization, and assertions for maintainable tests
  • Test isolation and reproducibility (e.g., seeding random data)
  • Integration with CI/CD and monitoring for regression detection

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.