mercredi 29 novembre 2017

Testing using an internal class

I have a module in Python to do some parsing. This module uses an internal state class. It looks somewhat like this:

class _State:
    ...

class Parser:
    @staticmethod
    def parse_int(state):
        ...

Now I want to test parse_int. However, I cannot from the test_parser.py function import _State (because it's internal) and therefore I cannot create one to test parse_int. What's the Python way to deal with this?

Aucun commentaire:

Enregistrer un commentaire