Commit 4d6efba3 authored by Fabien Amarger's avatar Fabien Amarger
Browse files

fix tests

parent 4991d576856c
Pipeline #90521 passed with stages
in 3 minutes and 13 seconds
......@@ -184,8 +184,8 @@
try:
return float(string)
except Exception:
if encoding is not None:
string = str(string, encoding)
if isinstance(string, bytes):
string = string.decode(encoding)
return string
......@@ -249,7 +249,6 @@
"""
if isinstance(input, str):
encoding = encoding or self.encoding
input = input.encode(self.encoding)
else:
encoding = None
rule_type, next = self._rewrite(" ".join(input.splitlines()))
......
......@@ -119,7 +119,7 @@
def test_include(self):
lines = [
(cmd, rgx.pattern, next)
for cmd, rgx, next in ail.read_from_string("include data/test2.ail")
for cmd, rgx, next in ail.read_from_string("include test/data/test2.ail")
]
self.assertEqual(
lines, [("TERMINAL", "(<\\?XML.*<RDF:RDF.*)$", "echo '%(0)s'")]
......@@ -227,7 +227,7 @@
def setUp(self):
self.kb = KB()
self.brain = ail.Brain(self.kb)
self.brain.load(["data/test2.ail"])
self.brain.load(["test/data/test2.ail"])
# self.brain._add_patterns(PATTERNS)
def test_long_input(self):
......@@ -231,7 +231,7 @@
# self.brain._add_patterns(PATTERNS)
def test_long_input(self):
input_file = "data/data_input"
input_file = "test/data/data_input"
f_pointer = open(input_file)
from_file = f_pointer.read()
f_pointer.close()
......@@ -243,7 +243,7 @@
def setUp(self):
self.kb = KB()
self.brain = ail.Brain(self.kb)
self.brain.load(["data/boucle.ail"])
self.brain.load(["test/data/boucle.ail"])
def test_boucle(self):
self.assertRaises(ail.InfiniteCycleError, self.brain.think, "bonjour")
......@@ -253,7 +253,7 @@
def setUp(self):
self.kb = KB()
self.brain = ail.Brain(self.kb)
self.brain.load(["data/regexp.ail"])
self.brain.load(["test/data/regexp.ail"])
def test_boucle(self):
self.brain.think("bonjour")
......@@ -280,7 +280,7 @@
def setUp(self):
self.kb = KB()
self.brain = ail.Brain(self.kb)
self.reload_file = "data/for_reload.ail"
self.reload_file = "test/data/for_reload.ail"
self.brain.load([self.reload_file])
# Make sure the reload_file is writable
ensure_fs_mode(self.reload_file, S_IWRITE)
......
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