Commit cb81eba3 authored by Nsukami Patrick's avatar Nsukami Patrick
Browse files

black: format without any compromise

parent 10de7e4981b9
Pipeline #110412 passed with stages
in 2 minutes and 30 seconds
......@@ -332,9 +332,9 @@ class ETypeResolver:
"""
self.debug: int = 0
self.set_schema(schema)
if uid_func_mapping:
if uid_func_mapping:
self.uid_func_mapping: UIDFuncMapping = uid_func_mapping
self.uid_func: Optional[Callable] = next(iter(uid_func_mapping.values()))
self.uid_func: Optional[Callable] = next(iter(uid_func_mapping.values()))
else:
self.uid_func_mapping = {}
self.uid_func = None
......
......@@ -356,7 +356,7 @@ class Union(Statement, Node):
optional translation function taking a string as argument and
returning a string
"""
tr = tr or (lambda msg, context=None : msg)
tr = tr or (lambda msg, context=None: msg)
return [
c.get_description(mainindex, tr)
......
......@@ -56,7 +56,7 @@ class EtypeFromPyobjTC(TestCase):
def test_string(self):
self.assertEqual(nodes.etype_from_pyobj("hop"), "String")
self.assertEqual(nodes.etype_from_pyobj(u"hop"), "String")
self.assertEqual(nodes.etype_from_pyobj("hop"), "String")
class TypesRestrictionNodesTest(TestCase):
......@@ -683,35 +683,35 @@ class NodesTest(TestCase):
tree = parse("Person X")
self.assertEqual(tree.as_string(), "Any X WHERE X is Person")
tree = parse(u"Any X WHERE X has_text 'hh'")
self.assertEqual(tree.as_string(), u'Any X WHERE X has_text "hh"')
tree = parse(u"Any X WHERE X has_text %(text)s")
tree = parse("Any X WHERE X has_text 'hh'")
self.assertEqual(tree.as_string(), 'Any X WHERE X has_text "hh"')
tree = parse("Any X WHERE X has_text %(text)s")
self.assertEqual(
tree.as_string({"text": u"hh"}), u'Any X WHERE X has_text "hh"'
tree.as_string({"text": "hh"}), 'Any X WHERE X has_text "hh"'
)
tree = parse(u"Any X WHERE X has_text %(text)s")
tree = parse("Any X WHERE X has_text %(text)s")
self.assertEqual(
tree.as_string({"text": u'h"h'}), u'Any X WHERE X has_text "h\\"h"'
tree.as_string({"text": 'h"h'}), 'Any X WHERE X has_text "h\\"h"'
)
tree = parse(u"Any X WHERE X has_text %(text)s")
tree = parse("Any X WHERE X has_text %(text)s")
self.assertEqual(
tree.as_string({"text": u"h\"'h"}), u'Any X WHERE X has_text "h\\"\'h"'
tree.as_string({"text": "h\"'h"}), 'Any X WHERE X has_text "h\\"\'h"'
)
def test_as_string_no_encoding(self):
tree = parse(u"Any X WHERE X has_text 'hh'")
self.assertEqual(tree.as_string(), u'Any X WHERE X has_text "hh"')
tree = parse(u"Any X WHERE X has_text %(text)s")
tree = parse("Any X WHERE X has_text 'hh'")
self.assertEqual(tree.as_string(), 'Any X WHERE X has_text "hh"')
tree = parse("Any X WHERE X has_text %(text)s")
self.assertEqual(
tree.as_string(kwargs={"text": u"hh"}), u'Any X WHERE X has_text "hh"'
tree.as_string(kwargs={"text": "hh"}), 'Any X WHERE X has_text "hh"'
)
def test_as_string_now_today_null(self):
tree = parse(u"Any X WHERE X name NULL")
tree = parse("Any X WHERE X name NULL")
self.assertEqual(tree.as_string(), "Any X WHERE X name NULL")
tree = parse(u"Any X WHERE X creation_date NOW")
tree = parse("Any X WHERE X creation_date NOW")
self.assertEqual(tree.as_string(), "Any X WHERE X creation_date NOW")
tree = parse(u"Any X WHERE X creation_date TODAY")
tree = parse("Any X WHERE X creation_date TODAY")
self.assertEqual(tree.as_string(), "Any X WHERE X creation_date TODAY")
def test_get_type_is_in(self):
......@@ -797,7 +797,7 @@ class NodesTest(TestCase):
)
def test_repr_encoding(self):
tree = parse(u'Any N where NOT N has_text "bidle"')
tree = parse('Any N where NOT N has_text "bidle"')
repr(tree)
def test_get_description_mainvar_objrel(self):
......@@ -821,31 +821,31 @@ class NodesTest(TestCase):
self.assertEqual(tree.get_description(0), [["String"]])
def test_replace_node_select(self):
tree = sparse(u'Any X, MAX(X) WHERE X name "toto tata"')
tree = sparse('Any X, MAX(X) WHERE X name "toto tata"')
select = tree.children[0]
funcnode = sparse(u"Any MAX(X)").children[0].selection[0]
funcnode = sparse("Any MAX(X)").children[0].selection[0]
select.replace(funcnode, nodes.Constant(1.0, "Float"))
def test_replace_node_orderby(self):
tree = sparse(u'Any X ORDERBY MAX(X) WHERE X name "toto tata"')
tree = sparse('Any X ORDERBY MAX(X) WHERE X name "toto tata"')
select = tree.children[0]
funcnode = sparse(u"Any X ORDERBY MAX(X)").children[0].orderby[0]
funcnode = sparse("Any X ORDERBY MAX(X)").children[0].orderby[0]
select.replace(funcnode, nodes.Constant(1.0, "Float"))
def test_replace_node_groupby(self):
tree = sparse(u'Any X GROUPBY X, MAX(X) WHERE X name "toto tata"')
tree = sparse('Any X GROUPBY X, MAX(X) WHERE X name "toto tata"')
select = tree.children[0]
funcnode = sparse(u"Any MAX(X)").children[0].selection[0]
funcnode = sparse("Any MAX(X)").children[0].selection[0]
select.replace(funcnode, nodes.Constant(1.0, "Float"))
def test_replace_node_having(self):
tree = sparse(u'Any X WHERE X name "toto tata" HAVING MAX(X) > 1')
tree = sparse('Any X WHERE X name "toto tata" HAVING MAX(X) > 1')
select = tree.children[0]
funcnode = sparse(u"Any X HAVING MAX(X) > 1").children[0].having[0]
funcnode = sparse("Any X HAVING MAX(X) > 1").children[0].having[0]
select.replace(funcnode, nodes.Constant(1.0, "Float"))
def test_undo_node_having(self):
qs = u"Any X WHERE X name N"
qs = "Any X WHERE X name N"
tree = sparse(qs)
select = tree.children[0]
select.save_state()
......
......@@ -70,7 +70,7 @@ SPEC_QUERIES = (
"X owned_by U, U login 'syt', X available true;"
),
(
u"Document X WHERE X occurence_of F, F class C, C name 'Bande dessinée', "
"Document X WHERE X occurence_of F, F class C, C name 'Bande dessinée', "
"X owned_by U, U login 'syt', X available true;"
),
(
......@@ -175,7 +175,7 @@ class ParserHercule(unittest.TestCase):
raise
def test_unicode_constant(self):
tree = self.parse(u"Any X WHERE X name 'Ångström';")
tree = self.parse("Any X WHERE X name 'Ångström';")
base = tree.children[0].where
comparison = base.children[1]
self.assertIsInstance(comparison, nodes.Comparison)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment