Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
logilab-common
Commits
72d88940e356
Commit
a5508606
authored
Oct 25, 2019
by
Nicola Spanti
Browse files
[py] Make flake8 a bit less angry
parent
c8b3f9dee096
Changes
3
Hide whitespace changes
Inline
Side-by-side
__pkginfo__.py
View file @
72d88940
...
...
@@ -3,22 +3,26 @@
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it
under
# the terms of the GNU Lesser General Public License as published by the
Free
# Software Foundation, either version 2.1 of the License, or (at your
option) any
# later version.
# logilab-common is free software: you can redistribute it and/or modify it
#
under
the terms of the GNU Lesser General Public License as published by the
#
Free
Software Foundation, either version 2.1 of the License, or (at your
#
option) any
later version.
#
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with logilab-common. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU Lesser General Public License
# along with logilab-common. If not, see <http://www.gnu.org/licenses/>.
"""logilab.common packaging information"""
__docformat__
=
"restructuredtext en"
import
sys
import
os
from
os.path
import
join
distname
=
'logilab-common'
modname
=
'common'
...
...
@@ -28,15 +32,15 @@ subpackage_master = True
numversion
=
(
1
,
4
,
3
)
version
=
'.'
.
join
([
str
(
num
)
for
num
in
numversion
])
license
=
'LGPL'
# 2.1 or later
description
=
"collection of low-level Python packages and modules used by Logilab projects"
license
=
'LGPL'
# 2.1 or later
description
=
(
"collection of low-level Python packages and modules"
" used by Logilab projects"
)
web
=
"http://www.logilab.org/project/%s"
%
distname
mailinglist
=
"mailto://python-projects@lists.logilab.org"
author
=
"Logilab"
author_email
=
"contact@logilab.fr"
from
os.path
import
join
scripts
=
[
join
(
'bin'
,
'logilab-pytest'
)]
include_dirs
=
[
join
(
'test'
,
'data'
)]
...
...
setup.py
View file @
72d88940
...
...
@@ -5,10 +5,10 @@
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it
under
# the terms of the GNU Lesser General Public License as published by the
Free
# Software Foundation, either version 2.1 of the License, or (at your
option) any
# later version.
# logilab-common is free software: you can redistribute it and/or modify it
#
under
the terms of the GNU Lesser General Public License as published by the
#
Free
Software Foundation, either version 2.1 of the License, or (at your
#
option) any
later version.
#
# logilab-common is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
...
...
test/unittest_textutils.py
View file @
72d88940
...
...
@@ -104,6 +104,7 @@ aller discuter avec les autres si c'est utile ou necessaire.""")
> .. _extrait:
> http://www.editions-eni.fr/Livres/Python-Les-fondamentaux-du-langage---La-programmation-pour-les-scientifiques-Extrait-du-livre/.20_d6eed0be-0d36-4384-be59-2dd09e081012_0_0.pdf"""
)
class
NormalizeParagraphTC
(
TestCase
):
def
test_known_values
(
self
):
...
...
@@ -167,15 +168,15 @@ class UnitsTC(TestCase):
def
test_unit_singleunit_singleletter
(
self
):
result
=
tu
.
apply_units
(
'15m'
,
self
.
units
)
self
.
assertEqual
(
result
,
15
*
self
.
units
[
'm'
]
)
self
.
assertEqual
(
result
,
15
*
self
.
units
[
'm'
])
def
test_unit_singleunit_multipleletter
(
self
):
result
=
tu
.
apply_units
(
'47KB'
,
self
.
units
)
self
.
assertEqual
(
result
,
47
*
self
.
units
[
'kb'
]
)
self
.
assertEqual
(
result
,
47
*
self
.
units
[
'kb'
])
def
test_unit_singleunit_caseinsensitive
(
self
):
result
=
tu
.
apply_units
(
'47kb'
,
self
.
units
)
self
.
assertEqual
(
result
,
47
*
self
.
units
[
'kb'
]
)
self
.
assertEqual
(
result
,
47
*
self
.
units
[
'kb'
])
def
test_unit_multipleunit
(
self
):
result
=
tu
.
apply_units
(
'47KB 1.5MB'
,
self
.
units
)
...
...
@@ -186,15 +187,22 @@ class UnitsTC(TestCase):
self
.
assertEqual
(
result
,
1000
*
self
.
units
[
'kb'
])
def
test_unit_wrong_input
(
self
):
self
.
assertRaises
(
ValueError
,
tu
.
apply_units
,
''
,
self
.
units
)
self
.
assertRaises
(
ValueError
,
tu
.
apply_units
,
'wrong input'
,
self
.
units
)
self
.
assertRaises
(
ValueError
,
tu
.
apply_units
,
'wrong13 input'
,
self
.
units
)
self
.
assertRaises
(
ValueError
,
tu
.
apply_units
,
'wrong input42'
,
self
.
units
)
self
.
assertRaises
(
ValueError
,
tu
.
apply_units
,
''
,
self
.
units
)
self
.
assertRaises
(
ValueError
,
tu
.
apply_units
,
'wrong input'
,
self
.
units
)
self
.
assertRaises
(
ValueError
,
tu
.
apply_units
,
'wrong13 input'
,
self
.
units
)
self
.
assertRaises
(
ValueError
,
tu
.
apply_units
,
'wrong input42'
,
self
.
units
)
with
self
.
assertRaises
(
ValueError
)
as
cm
:
tu
.
apply_units
(
'42 cakes'
,
self
.
units
)
self
.
assertIn
(
'invalid unit cakes.'
,
str
(
cm
.
exception
))
RGX
=
re
.
compile
(
'abcd'
)
class
PrettyMatchTC
(
TestCase
):
def
test_known
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment