Git Product home page Git Product logo

named_enum's Issues

Unit tests using pytest

RIght now there are doctests for each function.

However, that's not enough, unit tests using pytest framework are requisite for next release.

Frequently used ExtendedEnum, LabeledEnum

ExtendedEnum: In the software development, the normal Enum class is really oft extended with some extra common used functions to simplify its usages

LabeledEnum: the labeled enumeration contains normally 2 attributes: key and label, it's used to generate the choices for a dropdown.

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

incompatible with python 3.11

With python 3.11 we have the following error

File "named_enum/test.py", line 7, in <module>
    class NBALegendary(LabeledEnum):
  File "named_enum/named_enum/meta.py", line 152, in __new__
    namespace._convert(_tuple_cls)
  File "named_enum/named_enum/meta.py", line 75, in _convert
    self[name] = _last_values[i]
    ~~~~^^^^^^
  File "named_enum/meta.py", line 33, in __setitem__
    super().__setitem__(key, value)
  File "/usr/lib/python3.11/enum.py", line 449, in __setitem__
    self._member_names[key] = None
    ~~~~~~~~~~~~~~~~~~^^^^^
TypeError: list indices must be integers or slices, not str

Same script in python 3.10 seems to work fine

Reduce code block duplication in tests

Background

Currently a lot of tests have repeated some code blocks. To avoid the duplication and centralisation the tests, it's good to clean the tests.

Solution

  1. Create an abstract test class to hold the common used test functions as much as possible
  2. Each individual test class inherits from this abstract class and execute all the tests with its own inputs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.