def testAlwaysList(self): string = "a,b, c, 'd,e'" l = utils.alwaysList (string) self.assertEqual (l, ['a', 'b', 'c', "'d,e'"]) string = ["o1:var:{{c1}}", "o2:var:{{c2 | __import__('math').pow(float(_), 2.0)}}", "o3:file:{{c3.fn}}2{{c3.ext}}"] l = utils.alwaysList (string) self.assertEqual (l, string)
def test_alwaysList(data, trim, expect): assert alwaysList(data, trim) == expect
def test_alwaysList_raises(data): with pytest.raises(ValueError): alwaysList(data)