Skip to content

Commit

Permalink
Add test for NoneType comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
memona008 committed Dec 22, 2023
1 parent 673a056 commit 8a3ca4f
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions leval_tests/test_leval.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import time
from types import SimpleNamespace, NoneType
from types import SimpleNamespace

import pytest

Expand All @@ -10,12 +10,13 @@
NoSuchFunction,
NoSuchValue,
Timeout,
TooComplex, InvalidConstant,
TooComplex,
)
from leval.simple import simple_eval
from leval.universe.default import EvaluationUniverse
from leval.universe.weakly_typed import WeaklyTypedSimpleUniverse

NoneType = type(None)
values = {
"foo": 7,
"bar": 8,
Expand Down Expand Up @@ -104,12 +105,12 @@ def test_error(description, case, expected):
@pytest.mark.parametrize(
"kind, description, case, expected",
(
[("good",) + case for case in success_cases]
+ [
("bad",) + case
for case in error_cases
if case[-1] not in (InvalidOperands, NoSuchValue, NoSuchFunction)
]
[("good",) + case for case in success_cases]
+ [
("bad",) + case
for case in error_cases
if case[-1] not in (InvalidOperands, NoSuchValue, NoSuchFunction)
]
),
)
def test_verify(kind, description, case, expected):
Expand Down Expand Up @@ -170,7 +171,7 @@ def test_allowed_container_types():

@pytest.mark.parametrize(
"cases",
[['sup == None', 'foo != None', 'never == None']],
[["sup == None", "foo != None", "never == None"]],
)
def test_none_type_comparison(cases):
uni = WeaklyTypedSimpleUniverse(values=values, functions={})
Expand Down

0 comments on commit 8a3ca4f

Please sign in to comment.