2019.03.09 - fixed bug invalid character .'

This commit is contained in:
Fabian Scheuermann 2019-03-09 18:49:51 +01:00
parent 4957c34e45
commit 30b53b759c
2 changed files with 12 additions and 10 deletions

View File

@ -95,8 +95,8 @@ class BaseConverter:
else:
sign = 1
if set(string) > set(digits):
invalid = set(string) - set(digits)
if set(string) > set(digits+'.'):
invalid = set(string) - set(digits+'.')
raise ValueError('invalid character'.format(invalid))
if '.' in string:

View File

@ -12,10 +12,12 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from duodecimal import BaseConverter, duo, binary"
"from BaseConverter import BaseConverter, duo, binary"
]
},
{
@ -208,7 +210,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 2,
"metadata": {},
"outputs": [
{
@ -217,7 +219,7 @@
"1010(base2)"
]
},
"execution_count": 9,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
@ -228,7 +230,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 3,
"metadata": {},
"outputs": [
{
@ -237,7 +239,7 @@
"False"
]
},
"execution_count": 26,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
@ -248,7 +250,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 4,
"metadata": {},
"outputs": [
{
@ -257,7 +259,7 @@
"'42'"
]
},
"execution_count": 31,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}