Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UX Feedback #21

Open
pythoninthegrass opened this issue Apr 25, 2024 · 3 comments
Open

UX Feedback #21

pythoninthegrass opened this issue Apr 25, 2024 · 3 comments
Assignees

Comments

@pythoninthegrass
Copy link

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:

  • Index 3 has a giant bullet point for my first and last name
  • Index 10 doesn't render footnotes as expected
    • tbf this may be user error
  • Index 17 doesn't expand to viewport width (may be a limitation of absolute image size)
  • Index 23 shows the very first line of the python code block, but it'd be nice if it resized to show the entire codeblock
  • Index 24-28 formatting issues with bespoke code block
  • Index 32-39 ditto ^^
  • Index 49-50 thank you page is split across two pages

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.

Screen Shot 2024-04-24 at 10 20 10 PM
Screen Shot 2024-04-24 at 10 21 08 PM
Screen Shot 2024-04-24 at 10 21 57 PM
Screen Shot 2024-04-24 at 10 24 14 PM
Screen Shot 2024-04-24 at 10 25 10 PM

@pythoninthegrass
Copy link
Author

FWIW this is the raw markdown if you can't bust into my account

How to write tests with pytest

meetup-pytest

whoami

  • Lance Stephens

me-mt-rainier

Agenda

  • Zoom basic tells me I have 40 minutes
    • I'll try to keep it to 30 minutes for the remote folks
  • 10 minutes for Q&A

Agenda

  • What is pytest?
  • Why pytest?
  • Unit tests
  • Integration tests
  • Mocking
  • Fixtures
  • Demo
  • Q&A
  • Sources

What is pytest? 1

The pytest framework makes it easy to write small,
readable tests, and can scale to support complex
functional testing for applications and libraries.

Features

  • 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

Why pytest?

  • It's very easy to get started
    • Barrier to entry is low compared to vanilla unittest
    • Supports unit tests, integration tests, and end-to-end (E2E) tests
  • There's a lot of community support (11K+ stars on GitHub)
  • Official Playwright plugin for integration and E2E testing

Wildly detailed overview by somebody else 2

test-pyramid

Unit tests

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.

Unit tests

Exhibit A 3

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 tests

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. 4

Integration tests

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()

Mocking

TODO

Fixtures

TODO

Demo

TODO

Q&A

Questions?

Thank you!

Techlahoma

The Verge OKC

Sources

Footnotes

  1. https://docs.pytest.org/en/8.1.x/

  2. https://www.lambdatest.com/learning-hub/integration-testing

  3. https://en.wikipedia.org/wiki/Unit_testing

  4. https://en.wikipedia.org/wiki/Integration_testing

@alkrauss48
Copy link
Owner

alkrauss48 commented Apr 25, 2024

This is great feedback, and I was actually looking at your presentation a little bit ago. Some general thoughts to this are:

  • The bullet is big b/c it gets expanded along with the font-size of the text.
  • Footnotes currently aren't supported, though that's a neat idea; I had no idea that there were some extended markdown implementations that did that
  • 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 and make it always stretch to the full viewport width (at the risk of getting blurry), as you're not the first person who brought it up.
  • I think the Thank You page is behaving as expected; you might have edited it to look good.

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.

@pythoninthegrass
Copy link
Author

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

DO IIIIT

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

@alkrauss48 alkrauss48 self-assigned this Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants