Skip to content

Commit 5076c1a

Browse files
committed
improve tests
1 parent 4ef6943 commit 5076c1a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

Orange/widgets/data/tests/test_owfeatureconstructor.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,28 @@ def test_handles_builtins_in_expression(self):
277277
self.assertTrue(
278278
FeatureConstructorHandler().is_valid_item(
279279
OWFeatureConstructor.descriptors,
280-
StringDescriptor("X", "str(A)"),
280+
StringDescriptor("X", "str(A) + str(B)"),
281281
{"A": vartype(DiscreteVariable)},
282+
{"B": vartype(DiscreteVariable)}
283+
)
284+
)
285+
286+
# no variables is also ok
287+
self.assertTrue(
288+
FeatureConstructorHandler().is_valid_item(
289+
OWFeatureConstructor.descriptors,
290+
StringDescriptor("X", "str('foo')"),
291+
{},
292+
{}
293+
)
294+
)
295+
296+
# should fail on unknown variables
297+
self.assertFalse(
298+
FeatureConstructorHandler().is_valid_item(
299+
OWFeatureConstructor.descriptors,
300+
StringDescriptor("X", "str(X)"),
301+
{},
282302
{}
283303
)
284304
)

0 commit comments

Comments
 (0)