summaryrefslogtreecommitdiff
path: root/test/data
diff options
context:
space:
mode:
authorLaurent Peuch <cortex@worlddomination.be>2020-04-01 00:11:10 +0200
committerLaurent Peuch <cortex@worlddomination.be>2020-04-01 00:11:10 +0200
commitb8899451fa861b04568e2a0bb4e3fe4acc0daee3 (patch)
tree1446c809e19b5571b31b1999246aa0e50b19f5c8 /test/data
parent32cd73810056594f55eff0ffafebbdeb50c7a860 (diff)
downloadlogilab-common-b8899451fa861b04568e2a0bb4e3fe4acc0daee3.tar.gz
Black the whole code base
Diffstat (limited to 'test/data')
-rw-r--r--test/data/__pkginfo__.py36
-rw-r--r--test/data/deprecation.py1
-rw-r--r--test/data/lmfp/foo.py3
-rw-r--r--test/data/module.py18
-rw-r--r--test/data/module2.py67
-rw-r--r--test/data/noendingnewline.py11
-rw-r--r--test/data/nonregr.py3
-rw-r--r--test/data/regobjects.py15
-rw-r--r--test/data/regobjects2.py6
-rw-r--r--test/data/sub/momo.py2
10 files changed, 103 insertions, 59 deletions
diff --git a/test/data/__pkginfo__.py b/test/data/__pkginfo__.py
index d1f5731..51f36ec 100644
--- a/test/data/__pkginfo__.py
+++ b/test/data/__pkginfo__.py
@@ -20,15 +20,15 @@ __docformat__ = "restructuredtext en"
import sys
import os
-distname = 'logilab-common'
-modname = 'common'
-subpackage_of = 'logilab'
+distname = "logilab-common"
+modname = "common"
+subpackage_of = "logilab"
subpackage_master = True
numversion = (0, 63, 2)
-version = '.'.join([str(num) for num in numversion])
+version = ".".join([str(num) for num in numversion])
-license = 'LGPL' # 2.1 or later
+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"
@@ -37,19 +37,21 @@ author_email = "contact@logilab.fr"
from os.path import join
-scripts = [join('bin', 'logilab-pytest')]
-include_dirs = [join('test', 'data')]
+
+scripts = [join("bin", "logilab-pytest")]
+include_dirs = [join("test", "data")]
install_requires = []
-tests_require = ['pytz']
+tests_require = ["pytz"]
if sys.version_info < (2, 7):
- install_requires.append('unittest2 >= 0.5.1')
-if os.name == 'nt':
- install_requires.append('colorama')
-
-classifiers = ["Topic :: Utilities",
- "Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 3",
- ]
+ install_requires.append("unittest2 >= 0.5.1")
+if os.name == "nt":
+ install_requires.append("colorama")
+
+classifiers = [
+ "Topic :: Utilities",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 2",
+ "Programming Language :: Python :: 3",
+]
diff --git a/test/data/deprecation.py b/test/data/deprecation.py
index be3b103..3ef3c0f 100644
--- a/test/data/deprecation.py
+++ b/test/data/deprecation.py
@@ -1,4 +1,5 @@
# placeholder used by unittest_deprecation
+
def moving_target():
pass
diff --git a/test/data/lmfp/foo.py b/test/data/lmfp/foo.py
index 8f7de1e..841ea47 100644
--- a/test/data/lmfp/foo.py
+++ b/test/data/lmfp/foo.py
@@ -1,5 +1,6 @@
import sys
-if not getattr(sys, 'bar', None):
+
+if not getattr(sys, "bar", None):
sys.just_once = []
# there used to be two numbers here because
# of a load_module_from_path bug
diff --git a/test/data/module.py b/test/data/module.py
index 493e676..3b83811 100644
--- a/test/data/module.py
+++ b/test/data/module.py
@@ -21,11 +21,14 @@ def global_access(key, val):
else:
break
else:
- print('!!!')
+ print("!!!")
+
class YO:
"""hehe"""
- a=1
+
+ a = 1
+
def __init__(self):
try:
self.yo = 1
@@ -36,7 +39,8 @@ class YO:
except:
raise
-#print('*****>',YO.__dict__)
+
+# print('*****>',YO.__dict__)
class YOUPI(YO):
class_attr = None
@@ -51,19 +55,21 @@ class YOUPI(YO):
local = None
autre = [a for a, b in MY_DICT if b]
if b in autre:
- print('yo', end=' ')
+ print("yo", end=" ")
elif a in autre:
- print('hehe')
+ print("hehe")
global_access(local, val=autre)
finally:
return local
def static_method():
"""static method test"""
- assert MY_DICT, '???'
+ assert MY_DICT, "???"
+
static_method = staticmethod(static_method)
def class_method(cls):
"""class method test"""
exec(a, b)
+
class_method = classmethod(class_method)
diff --git a/test/data/module2.py b/test/data/module2.py
index 51509f3..7192904 100644
--- a/test/data/module2.py
+++ b/test/data/module2.py
@@ -1,51 +1,76 @@
from data.module import YO, YOUPI
import data
-class Specialization(YOUPI, YO): pass
-class Metaclass(type): pass
+class Specialization(YOUPI, YO):
+ pass
-class Interface: pass
-class MyIFace(Interface): pass
+class Metaclass(type):
+ pass
-class AnotherIFace(Interface): pass
-class MyException(Exception): pass
-class MyError(MyException): pass
+class Interface:
+ pass
-class AbstractClass(object):
+class MyIFace(Interface):
+ pass
+
+
+class AnotherIFace(Interface):
+ pass
+
+
+class MyException(Exception):
+ pass
+
+
+class MyError(MyException):
+ pass
+
+
+class AbstractClass(object):
def to_override(self, whatever):
raise NotImplementedError()
def return_something(self, param):
if param:
- return 'toto'
+ return "toto"
return
+
class Concrete0:
__implements__ = MyIFace
+
+
class Concrete1:
__implements__ = MyIFace, AnotherIFace
+
+
class Concrete2:
- __implements__ = (MyIFace,
- AnotherIFace)
-class Concrete23(Concrete1): pass
+ __implements__ = (MyIFace, AnotherIFace)
+
+
+class Concrete23(Concrete1):
+ pass
+
del YO.member
del YO
[SYN1, SYN2] = Concrete0, Concrete1
-assert '1'
+assert "1"
b = 1 | 2 & 3 ^ 8
-exec('c = 3')
-exec('c = 3', {}, {})
+exec("c = 3")
+exec("c = 3", {}, {})
+
def raise_string(a=2, *args, **kwargs):
- raise 'pas glop'
- raise Exception('yo')
- yield 'coucou'
+ raise "pas glop"
+ raise Exception("yo")
+ yield "coucou"
+
a = b + 2
c = b * 2
@@ -66,12 +91,14 @@ e = d[a:b:c]
raise_string(*args, **kwargs)
-print >> stream, 'bonjour'
-print >> stream, 'salut',
+print >> stream, "bonjour"
+print >> stream, "salut",
def make_class(any, base=data.module.YO, *args, **kwargs):
"""check base is correctly resolved to Concrete0"""
+
class Aaaa(base):
"""dynamic class"""
+
return Aaaa
diff --git a/test/data/noendingnewline.py b/test/data/noendingnewline.py
index 110f902..f309715 100644
--- a/test/data/noendingnewline.py
+++ b/test/data/noendingnewline.py
@@ -4,11 +4,9 @@ import unittest
class TestCase(unittest.TestCase):
-
def setUp(self):
unittest.TestCase.setUp(self)
-
def tearDown(self):
unittest.TestCase.tearDown(self)
@@ -16,11 +14,10 @@ class TestCase(unittest.TestCase):
self.a = 10
self.xxx()
-
def xxx(self):
if False:
pass
- print('a')
+ print("a")
if False:
pass
@@ -28,9 +25,9 @@ class TestCase(unittest.TestCase):
if False:
pass
- print('rara')
+ print("rara")
-if __name__ == '__main__':
- print('test2')
+if __name__ == "__main__":
+ print("test2")
unittest.main()
diff --git a/test/data/nonregr.py b/test/data/nonregr.py
index a4b5ef7..a8747a2 100644
--- a/test/data/nonregr.py
+++ b/test/data/nonregr.py
@@ -11,6 +11,7 @@ except NameError:
yield i, val
i += 1
+
def toto(value):
for k, v in value:
- print(v.get('yo'))
+ print(v.get("yo"))
diff --git a/test/data/regobjects.py b/test/data/regobjects.py
index 6cea558..4ad0e94 100644
--- a/test/data/regobjects.py
+++ b/test/data/regobjects.py
@@ -1,22 +1,29 @@
"""unittest_registry data file"""
from logilab.common.registry import yes, RegistrableObject, RegistrableInstance
+
class Proxy(object):
"""annoying object should that not be registered, nor cause error"""
+
def __getattr__(self, attr):
return 1
+
trap = Proxy()
+
class AppObjectClass(RegistrableObject):
- __registry__ = 'zereg'
- __regid__ = 'appobject1'
+ __registry__ = "zereg"
+ __regid__ = "appobject1"
__select__ = yes()
+
class AppObjectInstance(RegistrableInstance):
- __registry__ = 'zereg'
+ __registry__ = "zereg"
__select__ = yes()
+
def __init__(self, regid):
self.__regid__ = regid
-appobject2 = AppObjectInstance('appobject2')
+
+appobject2 = AppObjectInstance("appobject2")
diff --git a/test/data/regobjects2.py b/test/data/regobjects2.py
index 091b9f7..b6d5781 100644
--- a/test/data/regobjects2.py
+++ b/test/data/regobjects2.py
@@ -1,8 +1,10 @@
from logilab.common.registry import RegistrableObject, RegistrableInstance, yes
+
class MyRegistrableInstance(RegistrableInstance):
- __regid__ = 'appobject3'
+ __regid__ = "appobject3"
__select__ = yes()
- __registry__ = 'zereg'
+ __registry__ = "zereg"
+
instance = MyRegistrableInstance(__module__=__name__)
diff --git a/test/data/sub/momo.py b/test/data/sub/momo.py
index 746b5d0..ecf4ab5 100644
--- a/test/data/sub/momo.py
+++ b/test/data/sub/momo.py
@@ -1,3 +1,3 @@
from __future__ import print_function
-print('yo')
+print("yo")