Move revbank test asserts to a test file
This commit is contained in:
parent
334906bbf3
commit
d69f35cfcc
2 changed files with 16 additions and 10 deletions
|
@ -50,16 +50,6 @@ class Product:
|
||||||
return f'{aliases:<30} {price:<6} {description:<60} {metadata}'
|
return f'{aliases:<30} {price:<6} {description:<60} {metadata}'
|
||||||
|
|
||||||
|
|
||||||
assert Product.from_line('8711327538481,liuk 0.80 "Ola Liuk" #ah=wi162664 #qty=8') == \
|
|
||||||
Product(['8711327538481','liuk'], Decimal('0.8'), 'Ola Liuk', {'ah': 'wi162664', 'qty': '8'})
|
|
||||||
assert Product.from_line('5000112659184,colazero 1.00 "Cola Zero" #sligro') == \
|
|
||||||
Product(['5000112659184','colazero'], Decimal(1), 'Cola Zero', {'sligro': None})
|
|
||||||
assert Product.from_line('8711327538481,liuk 0.80 "Ola Liuk" #ah=wi162664 #qty=8').format_line() == \
|
|
||||||
'8711327538481,liuk 0.80 "Ola Liuk" #ah=wi162664 #qty=8'
|
|
||||||
assert Product(['5000112659184','colazero'], Decimal(1), 'Cola Zero', {'sligro': None}).format_line() == \
|
|
||||||
'5000112659184,colazero 1.00 "Cola Zero" #sligro'
|
|
||||||
|
|
||||||
|
|
||||||
class NoAutoUpdate(Exception):
|
class NoAutoUpdate(Exception):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__('no auto update directive')
|
super().__init__('no auto update directive')
|
||||||
|
|
16
inflatinator/revbank_test.py
Normal file
16
inflatinator/revbank_test.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from revbank import Product
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
|
def test_parse_product_lines():
|
||||||
|
assert Product.from_line('8711327538481,liuk 0.80 "Ola Liuk" #ah=wi162664 #qty=8') == \
|
||||||
|
Product(['8711327538481','liuk'], Decimal('0.8'), 'Ola Liuk', {'ah': 'wi162664', 'qty': '8'})
|
||||||
|
assert Product.from_line('5000112659184,colazero 1.00 "Cola Zero" #sligro') == \
|
||||||
|
Product(['5000112659184','colazero'], Decimal(1), 'Cola Zero', {'sligro': None})
|
||||||
|
|
||||||
|
|
||||||
|
def test_format_product_lines():
|
||||||
|
assert Product.from_line('8711327538481,liuk 0.80 "Ola Liuk" #ah=wi162664 #qty=8').format_line() == \
|
||||||
|
'8711327538481,liuk 0.80 "Ola Liuk" #ah=wi162664 #qty=8'
|
||||||
|
assert Product(['5000112659184','colazero'], Decimal(1), 'Cola Zero', {'sligro': None}).format_line() == \
|
||||||
|
'5000112659184,colazero 1.00 "Cola Zero" #sligro'
|
Loading…
Add table
Add a link
Reference in a new issue