diff --git a/examples/codepage_tables.py b/examples/codepage_tables.py index fb535c7..e19ea3f 100644 --- a/examples/codepage_tables.py +++ b/examples/codepage_tables.py @@ -56,4 +56,5 @@ def print_codepage(printer, codepage): printer._raw(sep) printer._raw('\n') -main() \ No newline at end of file +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/src/escpos/capabilities.py b/src/escpos/capabilities.py index 4fa9664..a3bfd3a 100644 --- a/src/escpos/capabilities.py +++ b/src/escpos/capabilities.py @@ -99,9 +99,10 @@ def clean(s): return str(s) -# For users, who want to provide their profile class Profile(get_profile_class('default')): - + """ + For users, who want to provide their profile + """ def __init__(self, columns=None, features=None): super(Profile, self).__init__() diff --git a/src/escpos/magicencode.py b/src/escpos/magicencode.py index 770703c..3dbd256 100644 --- a/src/escpos/magicencode.py +++ b/src/escpos/magicencode.py @@ -208,14 +208,20 @@ class MagicEncode(object): If the printer does not support a suitable code page, it can insert an error character. - - :param encoding: If you know the current encoding of the printer - when initializing this class, set it here. If the current - encoding is unknown, the first character emitted will be a - codepage switch. """ def __init__(self, driver, encoding=None, disabled=False, defaultsymbol='?', encoder=None): + """ + + :param driver: + :param encoding: If you know the current encoding of the printer + when initializing this class, set it here. If the current + encoding is unknown, the first character emitted will be a + codepage switch. + :param disabled: + :param defaultsymbol: + :param encoder: + """ if disabled and not encoding: raise Error('If you disable magic encode, you need to define an encoding!') diff --git a/test/test_magicencode.py b/test/test_magicencode.py index fc7a31e..faaf66d 100644 --- a/test/test_magicencode.py +++ b/test/test_magicencode.py @@ -24,6 +24,9 @@ from escpos.exceptions import CharCodeError, Error class TestEncoder: + """ + Tests the single encoders. + """ def test_can_encode(self): assert not Encoder({'CP437': 1}).can_encode('CP437', u'€') @@ -40,10 +43,21 @@ class TestEncoder: class TestMagicEncode: + """ + Tests the magic encode functionality. + """ class TestInit: + """ + Test initialization. + """ def test_disabled_requires_encoding(self, driver): + """ + Test that disabled without encoder raises an error. + + :param driver: + """ with pytest.raises(Error): MagicEncode(driver, disabled=True)