Skip to main content

All Questions

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

Function to calculate energy where all parameters must be positive

I have a function which requires all parameters to be positive: ...
Idieh's user avatar
  • 73
5 votes
1 answer
364 views

Trying Out DDD : How to enforce data integrity and immutability

I've been transitioning from type-safe programming languages like Dart and Java to Python, and I'm trying to enforce Domain-Driven Design (DDD) principles in a language that naturally leans towards ...
koussay issaoui's user avatar
3 votes
1 answer
98 views

Build a dictionary from a string by the extraction of data from all the pairs <TAG|VAL> contained inside the string and clean string from TAGs

I have written code to manage a string and retrieve from it a dictionary which must contain pairs key-value dependent from the string. To be more clear I'll show ...
User051209's user avatar
2 votes
2 answers
99 views

Goal: Writing Effective Unit Tests to Ensure a Datetime Conversion To/From Local-UTC Works

As the title lists, I am trying to write an effective unittest suite to ensure that the function that converts a date to UTC from local or vice-versa is doing as planned. But it seems hard because ...
0004's user avatar
  • 121
1 vote
1 answer
81 views

Event manager based on decorators

This module is a simple event manager that works with decorators. I would like feedback on: Bugs Any ideas to get rid of the classevent decorator, which ...
rdesparbes's user avatar
5 votes
1 answer
200 views

Testing binary search module, based on bisect

The bisect module can only find the index to insert an element. I created a simple class based on the bisect module for precise searching and covered all the edge cases that came to mind with tests. ...
Aycon's user avatar
  • 225
1 vote
1 answer
67 views

Testing code for An+B microsyntax parsing library

I have a small package that provides some API for playing around with the <An+B> CSS microsyntax. It is 100% type hinted and tested, but doesn't actually have any real/useful features and this ...
InSync's user avatar
  • 339
6 votes
3 answers
2k views

Python strong password validator ( with unit test )

Lately, I was studying the concept of unit testing in python, so I have decided to write a imperative strong password validator ( checker ) and also attach a unit test to it. I would like to know if ...
KhodeNima's user avatar
  • 419
2 votes
1 answer
271 views

Test suite for population-count function, using random input

For the purpose of this discussion, I have the following function: ...
joseville's user avatar
  • 516
1 vote
1 answer
157 views

Change unit-test structure to avoid try/except/finally clause

I have 10 or 20 tests with the same structure which I would like to improve. The test itself is nested within a try/except/finally clause to make sure that some of ...
Mathieu's user avatar
  • 251
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
0 votes
0 answers
88 views

Generate INSERTs from function parameters with jinja2

I'm writing unit-tests with pytest for sqlite database and reporting functions and I need to arrange them by inserting minimal ...
t3chb0t's user avatar
  • 44.5k
4 votes
2 answers
2k views

Clean up directories and files when a unit test fails

While running unit tests (most of them integration tests) with Python I create some directories. They need to be deleted after the test or when the test fails. The execution of the cleanup code need ...
buhtz's user avatar
  • 219
4 votes
1 answer
198 views

Python unit tests for storing and loading objects

I wrote some code and thought I may get better with some feedback. I program for almost 5 years, mainly in python. I care most about the unit testing. I am not really sure, how industry standard unit ...
Cjw9000's user avatar
  • 41
1 vote
0 answers
58 views

UPDATE on Newspaper Bill Calculator CLI with Python (3 of 3, Database)

Code is posted after explanation. Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused. Post 1 of 3, Core: UPDATE 1 on Newspaper ...
eccentricOrange's user avatar

15 30 50 per page
1
2 3 4 5
14