Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
2 answers
115 views

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

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 2 of 3, CLI: UPDATE 1 on Newspaper ...
eccentricOrange's user avatar
2 votes
1 answer
134 views

Newspaper Bill Calculator CLI with Python (1 of 3, Core)

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 2 of 3, CLI: Newspaper Bill ...
eccentricOrange's user avatar
3 votes
0 answers
126 views

Testing a javascript function that performs side effects

Application context I am working on a game I call "Apes and Snakes". So far the code only allows players to connect to a host using a room code and WebRTC. Players and the host send messages ...
Scoob's user avatar
  • 131
2 votes
1 answer
109 views

This technique for functional programming, and testing functional programming

I've been playing around with functional programming and testing with jest recently. An issue I've run into, is that it's hard to mock ES6 module exports directly. See this Stack Overflow question ...
dwjohnston's user avatar
  • 1,358
3 votes
0 answers
50 views

Test Driven Development in JS and Sinon Stub

I am going through some TDD and BDD tutorials which guide one through implementing a simple beverage-ordering system. While I think I understand the material, I am still wondering about some ...
MadPhysicist's user avatar
10 votes
1 answer
1k views

Generate iCalendar .ics files with events for astrological aspects

I'm relatively new to Python, coming from a deep C++ background. I'm mostly looking for feedback on how to make my code more idiomatic/pythonic, but I would welcome and appreciate any and all other ...
feuGene's user avatar
  • 363
4 votes
1 answer
1k views

WAKE UP! CodingBat alarm clock

I'm brand new at Python, but I've been working in general at granulating my functions and being as self-readable as possible without suffering readability. This CodingBat question is a little ...
BrainFRZ's user avatar
  • 841
8 votes
1 answer
907 views

"Curious Numbers" (HackerRank PE 34)

I was inspired by a certain recent question to try my hand at this challenge: Project Euler #34: Digit factorials \$19!\$ is a curious number, as \$1!+9!=1+362880=362881\$ is divisible by \$19\$. ...
Phrancis's user avatar
  • 20.5k
8 votes
2 answers
1k views

Mock/Stub out filesystem in F# for unit testing

I'm looking to do some basic verification testing on my functions that write to the filesystem. I took a hint from here on how to mock out the filesystem using an interface, but I'm kinda bummed on ...
koenmetsu's user avatar
  • 183
6 votes
1 answer
157 views

Monoalphatic and Polialphabetic cipher in Ruby

This code encrypts a text with mono-alphabetic and poli-alphabetic substitutions ciphers. For further info see: Mono-alphabetic/Caesar Cipher Poli-alphabetic cipher ...
Caridorc's user avatar
  • 28.1k
4 votes
1 answer
466 views

Is a unit test which uses LINQ to check multiple values acceptable?

I'm writing unit tests for a library which parses colors from user input (example: the user input “#f00” gives a red color; the user input “60,100%,100%” gives a yellow color, etc.) One of the ...
Arseni Mourzenko's user avatar
4 votes
2 answers
2k views

How do I dynamically create Python unit tests in a readable way?

I have Django unit tests that are pretty much the following format: ...
Kimvais's user avatar
  • 141