#MeetTala: Build a Python Testing Framework with Florian Hartl

Tala’s culture of innovation thrives on having a team of people with global backgrounds, expertise and interests. One such team member is Florian Hartl, a data scientist and tennis enthusiast. Florian was born and raised in Germany, and worked in machine learning and data engineering roles in Munich and Silicon Valley before joining Tala in January 2018.

He credits a “lucky coincidence” for helping him find his passion for data science — a passion he shares with us below, and in his workshop on building and understanding python testing frameworks.

Why did you join #TeamTala?
About a year ago, I relocated from San Francisco to Los Angeles and worked remotely for Yelp. It didn’t take long for me to realize that I wanted to be part of a vibrant office again, working through challenging problems with people in the same room and not just on a laptop screen. Additionally, I wanted to work at a startup again, ideally one with a product with potential to change the world for better. To get an overview of LA’s startup landscape, I developed a spreadsheet of over 150+ companies, ranked by different criteria like location, product, or potential. Tala got ranked number one! I applied for a data scientist position and once I saw, during the interview process, how smart, humble, and mission-driven people here are, I knew that Tala was exactly what I was looking for.

I am a big proponent of the phrase ‘never stop learning.’ Tala is a fast-growing company with a very diverse set of people, motivated by a shared mission. That’s a challenging environment, which, for me, is ideal for learning and growing. As part of the team, I’d like to improve my statistics and advanced math knowledge, as well as design and build multiple high-impact predictive models from the ground up. Especially the latter — given that getting modeling experience can be difficult to come by in larger companies, due to stronger domain specialization and infrastructural challenges.

It’s also great to be part of a team where data science is core to the mission. Our ability to serve customers wouldn’t be feasible without data, which we currently use to make accurate and personalized predictions for loan repayment, or to identify fraud. Data enables our product, and it’s important to me to be in a role that uses data for good.

What’s the data science team and culture like at Tala?
We are a group of people with diverse backgrounds, ranging from astrophysics and oceanography to ones you’d rather expect like statistics or computer science. Some common practices we follow are part of the agile software development paradigm: sprints, daily standups, retrospectives. Because we’re still a small and nimble team, we are constantly adapting the processes in such a way that it works best for us as a team.

I really like how much we support each other. There’s never a feeling of superiority or someone’s ego in the way of making progress together as a team. One exception to this, at least in my books, are our office-wide ping pong tournaments! I’m looking forward to growing as a company by bringing more talented people onboard to help out with our mission.

The Tala data science pod

You’ll be sharing a framework for testing Python. What are the goals of the workshop?
I’d say there are three goals:

  1. To communicate the importance of unit testing your code. While I understand that in the early days of a startup writing tests might not be the most effective use of time due to fast approaching deadlines and many changes in the strategic direction, once the company is a bit more mature, the guideline should be: “Production code? Unit tests!” Well-written tests enable efficient scaling beyond a certain point (like lines of code or engineers) and I also believe they lead to happier engineers because we generally don’t enjoy accidentally breaking things and seeing all tests passing is one of those rare moments of bliss.
  2. To interactively teach how to write good unit tests. The emphasis here is on “good.” Writing tests is easy but writing good tests is a bit of an art. That’s also why some code can have a test coverage of 100% but be riddled with bugs and very poorly tested. Trying to convey this crucial aspect is easier in an interactive workshop setting than through a presentation because it helps to go through hands-on exercises.
  3. To explain the applied tools and how they all can be combined to create an efficient, user-friendly testing framework for any Python project. Seeing what each tool’s job is and the step-by-step process of bundling them together makes it much easier to understand the final framework which otherwise can be intimidating due to the sheer amount of novelty.

How could employing unit testing change our practices?
Assuming you were tasked with slightly modifying one of our business-critical models, wouldn’t you feel more at ease if you knew that the whole codebase is well tested and that in case your changes have an unexpected effect you’d get notified by breaking tests? It is true that instead of automated unit tests, you could spend days of manual testing and monitoring, but that’s not scalable, especially as our models and services become more complex.

How could testing code in this way make someone a better 
data scientist?
The best data scientists I’ve gotten to know throughout my career are not only extremely strong in math and modeling but they are also skilled engineers. I think one reason for this is the appreciation for simplicity you develop once you have an understanding of the immense engineering efforts involved in deploying a model to production and maintaining it.

More importantly, data scientists who are also good engineers can see a project through from beginning to end, which is a very powerful skill to have. In that sense, I think that knowing how to properly test code should be part of a data scientist’s toolbox because it’s essential for being a good engineer.

When you go through the workshop, you will learn…

  • how to use the tools: pytest, mock, coverage, tox, and make
  • how to combine them to create a simple testing framework
  • how to write good unit tests

At the end, you will be able to set up a simple yet powerful testing framework for Python in less than five minutes for your personal projects. From then on, all you need to do is write good tests and run “make test” to execute them. While it is targeted at beginners in the realm of testing, I think that more seasoned testers will also find it helpful and maybe even be able to use it for their own teaching purposes.

Now, it’s your turn — try it! Check out Florian’s Python Testing Framework workshop here and let us know what you think in the comments!

Want to build with Florian and #TeamTala? We’re hiring! 
We are data scientists, engineers, customer experience designers, people-oriented professionals, marketers, and finance geeks all passionate about extending financial freedom to the billions of underserved people across the globe. We believe in people from every type of background — around the world, and within our company. We call this #RadicalTrust. 
Come join our global team at