Open pythoninthegrass opened 6 months ago
FWIW this is the raw markdown if you can't bust into my account
whoami
The pytest framework makes it easy to write small, readable tests, and can scale to support complex functional testing for applications and libraries.
- Detailed info on failing assert statements (no need to remember self.assert* names)
- Auto-discovery of test modules and functions
- Modular fixtures for managing small or parametrized long-lived test resources
- Can run unittest (including trial) test suites out of the box
- Python 3.8+ or PyPy 3
- Rich plugin architecture, with over 1300+ external plugins and thriving community
unittest
unittest is Python's built-in testing framework.
The unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework.
A unit is the smallest testable part of an application. In procedural programming, a unit could be an entire module, but it is more commonly an individual function or method.
Exhibit A ^4
import unittest
class TestStringMethods(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_isupper(self):
self.assertTrue('FOO'.isupper())
self.assertFalse('Foo'.isupper())
def test_split(self):
s = 'hello world'
self.assertEqual(s.split(), ['hello', 'world'])
# check that s.split fails when the separator is not a string
with self.assertRaises(TypeError):
s.split(2)
if __name__ == '__main__':
unittest.main()
Integration testing is the phase in software testing in which the whole software module is tested... It occurs after unit testing and before system testing. Integration testing takes as its input modules that have been unt tested, groups them in larger aggregates, applies tests defined in an integration test plan to those aggregates, and delivers as its output the integrated system ready for system testing. ^5
Exhibit B
import unittest
class TestBasic(unittest.TestCase):
def setUp(self):
# Load test data
self.app = App(database='fixtures/test_basic.json')
def test_customer_count(self):
self.assertEqual(len(self.app.customers), 100)
def test_existence_of_customer(self):
customer = self.app.get_customer(id=10)
self.assertEqual(customer.name, "Org XYZ")
self.assertEqual(customer.address, "10 Red Road, Reading")
class TestComplexData(unittest.TestCase):
def setUp(self):
# load test data
self.app = App(database='fixtures/test_complex.json')
def test_customer_count(self):
self.assertEqual(len(self.app.customers), 10000)
def test_existence_of_customer(self):
customer = self.app.get_customer(id=9999)
self.assertEqual(customer.name, u"バナナ")
self.assertEqual(customer.address, "10 Red Road, Akihabara, Tokyo")
if __name__ == '__main__':
unittest.main()
TODO
TODO
TODO
Questions?
This is great feedback, and I was actually looking at your presentation a little bit ago. Some general thoughts to this are:
That brings me to the biggest issue you brought up which I hadn't ever thought about; code blocks that have line breaks. Currently slides are separated by double new lines (\n\n or \r\n), regardless of how it is formatted; that's why your code blocks are looking weird and are separated across multiple slides.
This is something that I probably will want to address, and I'm surprised I haven't really run into it myself yet. I'll check it out in the near future!
Thanks so much for the feedback, it is much appreciated.
The image also isn't expanded b/c of what you said; it won't get stretched beyond its current resolution. This is something I could be convinced to change
Think the only deal breaker is the code blocks tbh. But the other stuff is nice to have. I'll toy around with formatting tomorrow when I finish the presentation.
Great work, sir! Very pleasant experience in my first go-around
Hey Aaron!
Testing out Simple Slides for my presentation this weekend. Very polished overall and easy to use!
Not sure how much access you have, but my pytest talk has some silly behavior atm:
Entirely possible that it's me holding markdown wrong. Know other apps like Deckset splits pages by
---
kinda like front matter in YAML.Using macOS 12.7.4 (21H1123), Firefox 124.0.2.
Lmk if you need any more details.