def test_list_one(monkeypatch): monkeypatch.setenv("foo", "bar") assert parsenvy.list("foo") == ["bar"]
def test_list_empty(monkeypatch): monkeypatch.setenv("foo", "") assert parsenvy.list("foo", ["bar"]) == ["bar"]
def test_list_several(monkeypatch): monkeypatch.setenv("foo", "bar,baz,barf") assert parsenvy.list("foo") == ["bar", "baz", "barf"]
def test_list_multiple_commas(monkeypatch): monkeypatch.setenv("foo", ",,,") assert parsenvy.list("foo") == ["", "", "", ""]
def test_list_one_comma(monkeypatch): monkeypatch.setenv("foo", ",") assert parsenvy.list("foo") == ["", ""]
def test_default(self): self.assertEqual(parsenvy.list('LIST_NONE', [1, 2]), [1, 2])
def test_none(self): self.assertIsNone(parsenvy.list('LIST_NONE')) os.environ['LIST_EMPTY'] = '' self.assertIsNone(parsenvy.list('LIST_EMPTY'))
def test_list(self): os.environ['LIST_A_B_C'] = 'a,b,c' self.assertEqual(parsenvy.list('LIST_A_B_C'), ['a', 'b', 'c'])