Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
4 votes
3 answers
376 views

Money class in python

I have recently created the Money class with a helper class Currency. What do you think about the following code? I created unit ...
whiteman808's user avatar
4 votes
1 answer
172 views

Is this a good unit test for testing three types of mappings all at once?

This question is related to my previous two questions, in which I have implemented HashTable, and also SortedListMap and ...
user141240's user avatar
6 votes
1 answer
3k views

Multiplayer card game "Hearts" with OOP in Python

To practice Object-Oriented Python and learning how to write tests, I found an exercise and solved it as below(all classes are put in one block of code to make the question a little bit more readable):...
aderchox's user avatar
  • 217
3 votes
1 answer
170 views

Testing Terminal Text Game with Classes and Game Loop

I am making a super simple and dumb terminal text game to try out unittest in python. I have ran into a problem. When I run the test, the game loop is ran, and I have to manually insert input to ...
CliffJ's user avatar
  • 33
10 votes
3 answers
2k views

Secrets management, operational security, keeping API tokens hidden while streaming

I've taken up code streaming and I'm concerned that as I do so, I'll leak an API token somewhere. It was suggested that I use something like "a secrets.toml or secrets.yaml or secrets.json file." But ...
Aaron Hall's user avatar
  • 1,568
3 votes
2 answers
298 views

Simple OOP currency converter - follow-up

This is a follow up question on this post This is what I changed on my previous code: I use Exchanger and PairCurrency class ...
Nguyen's user avatar
  • 105
5 votes
1 answer
88 views

Class to parse a file sanitizing each line with a set of methods

I am parsing a set of lines from a file, after reading the file content with Parser.read_file() I apply a set of methods to solve different issues each line may ...
marcanuy's user avatar
  • 305
2 votes
1 answer
3k views

Computing the profit or loss from a list of trades

I am coming from C# and I am learning how to use Python more seriously. So I decided to try a little side project to help me see how much I earn (or lose) from my trades on the stock market. I would ...
Octoplus's user avatar
  • 175
3 votes
1 answer
1k views

Simple geometry problems involving rectangles and circles in Python 3

I'm working with some simple geometry problems featuring rectangles and circles. My code is as follows: ...
SassySamurai's user avatar
3 votes
3 answers
5k views

Bowling scoring kata

I've been writing basic Python scripts for a while now to help process data or automate some task but I've decided I should start picking up unit testing and objective orientated programming (the vast ...
ydaetskcoR's user avatar
1 vote
0 answers
2k views

Unit tests for a Redshift wrapper class

I'm somewhat new to TDD and unit testing, but I've written a suite of unit tests to check my functionality. The basic classes automate simple load and unload operations from s3 and redshift, and ...
flybonzai's user avatar
  • 355