Skip to content
Snippets Groups Projects
Commit 2dcbecce authored by Ismail Moumni's avatar Ismail Moumni
Browse files

removing test_print

parent d453f04f
No related branches found
No related tags found
1 merge request!5Wip adding tests and json functions
......@@ -5,4 +5,5 @@
/.venv~
__init__.py
/rdos-python/__pycache__
/tests/.vscode/settings.json
\ No newline at end of file
/tests/.vscode/settings.json
/tests/test_print.py
\ No newline at end of file
......@@ -44,7 +44,7 @@ def run_client(Host, Port, message: str):
# Function match_dict returns non existing fields in a dict
# Function input biblio and dict
# Function returns a list containing missing values
def match_dict(biblio: dict, gen: dict):
def missing_keys(biblio: dict, gen: dict):
missing = []
if(biblio is not None):
for key in biblio:
......@@ -86,7 +86,7 @@ def send_message(s: socket, message: dict):
data = s.recv(1024)
return data
except Exception:
match = match_dict(message, __RDOS_Gen__)
match = missing_keys(message, __RDOS_Gen__)
print("Missing parameters:" % match)
except ValueError as msg:
print("Erreur requete Vide " % msg)
......
......@@ -7,11 +7,11 @@ test_dict1 = {"name": "Michael", "Rafael": "Nadal"}
test_dict2 = {"name": "Michael", "Rafael": ""}
def test_match():
var = c.match_dict(test_dict1, test_dict2)
def test_missing_keys():
var = c.missing_keys(test_dict1, test_dict2)
assert not var
def test_bad_match_dict():
def test_bad_missing():
with pytest.raises(Exception):
assert c.match_dict({}, test_dict1)
assert c.missing_keys({}, test_dict1)
......@@ -12,15 +12,15 @@ obj2 = json.loads(bad_data)
def test_match_dict():
var = c.match_dict(obj, obj)
var = c.missing_keys(obj, obj)
assert var == []
def test_diff_match_dict():
result = c.match_dict(obj, obj2)
result = c.missing_keys(obj, obj2)
assert result is not None
def test_bad_match_dict():
with pytest.raises(Exception):
assert c.match_dict({}, obj)
assert c.missing_keys({}, obj)
import client
print(client.match_dict({"ismail": "lonis"}, {"ismail": "lonis", "ahmed": "lonis"}))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment