~/talk

Unit Testing for Data Scientists

Talkat PyData NYC 2018 · 2018-10-11..10-12· [testing]
links:none on file
slides:none on file

The talk argues that unit tests give concrete confidence by isolating specific functionality and recommends starting small while refactoring. It demonstrates using pytest fixtures to share pandas DataFrames, creating a reusable local Spark session fixture scoped to the session so tests avoid spinning clusters, and using unittest.mock / magic mock with mock.patch to replace create_engine and pandas.read_sql so tests run offline and assert calls and return controlled DataFrames, which proves reliable for data workflows.

AI-written summary · about

  1. 0:00Unit testing intro for data scientists
  2. 1:05Why unit testing matters
  3. 3:40Challenges adopting unit tests
  4. 5:27Data science workflow complexities
  5. 6:31Start small with unit testing
  6. 9:03Introducing pytest
  7. 10:08First unit test with pytest
  8. 12:20Pytest fixtures for test data
  9. 16:19Built-in pytest fixtures for debugging
  10. 18:07Advanced fixture features
  11. 22:24Mocking dependencies
  12. 23:30Mocking database access
  13. 26:39Understanding Python mocks
  14. 29:50Mock behaviors and return values
  15. 31:13Mock side effects and exceptions
  16. 34:05Asserting mock interactions
  17. 36:56Mocking pitfalls and gotchas
  18. 38:20Testing resources and reading
  19. 39:02Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.