mirror of
https://git.wownero.com/lza_menace/wownero-python.git
synced 2024-08-15 03:25:25 +00:00
continuous integration goodies from rooterkyberian (#26)
* continuous integration goodies * fixed test_address not running * fixup `python setup.py test` * fixup readme.rst formatting
This commit is contained in:
parent
7176f3fa0f
commit
12e69da496
8 changed files with 107 additions and 1 deletions
|
@ -1,8 +1,14 @@
|
|||
import unittest
|
||||
|
||||
from monero.address import Address, SubAddress, IntegratedAddress, address
|
||||
from tests.utils import classproperty
|
||||
|
||||
|
||||
class Tests(object):
|
||||
@classproperty
|
||||
def __test__(cls):
|
||||
return issubclass(cls, unittest.TestCase)
|
||||
|
||||
def test_from_and_to_string(self):
|
||||
a = Address(self.addr)
|
||||
self.assertEqual(str(a), self.addr)
|
||||
|
@ -112,7 +118,6 @@ class Tests(object):
|
|||
address,
|
||||
'Cf6RinMUztY5otm6NEFjg3UWBBkXK6Lh23wKrLFMEcCY7i3A6aPLH9i4QMCkf6CdWk8Q9N7yoJf7ANKgtQMuPM6JANXgCWs')
|
||||
|
||||
|
||||
def test_type_mismatch(self):
|
||||
self.assertRaises(ValueError, Address, self.iaddr)
|
||||
self.assertRaises(ValueError, Address, self.subaddr)
|
||||
|
|
14
tests/utils.py
Normal file
14
tests/utils.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
class ClassPropertyDescriptor(object):
|
||||
"""Based on https://stackoverflow.com/questions/5189699/how-to-make-a-class-property"""
|
||||
|
||||
def __init__(self, fget):
|
||||
self.fget = fget
|
||||
|
||||
def __get__(self, obj, klass):
|
||||
if klass is None:
|
||||
klass = type(obj)
|
||||
return self.fget.__get__(obj, klass)()
|
||||
|
||||
|
||||
def classproperty(func):
|
||||
return ClassPropertyDescriptor(classmethod(func))
|
Loading…
Add table
Add a link
Reference in a new issue