コード例 #1
0
 def test_serialize_parse(self):
     a = parameter.choices(["1", "2", "3"])[str]._p
     b = "3"
     assert b == a.parse_from_str(a.to_str(b))
コード例 #2
0
 def test_invalid_choice_type(self):
     with pytest.raises(AssertionError):
         parameter.choices([1, 2, "3"])[int]._p.validate(2)
コード例 #3
0
 def test_parse_int_conv(self):
     d = parameter.choices([1, 2, 3])[int]._p
     assert 3 == d.parse_from_str("3")
コード例 #4
0
 def test_invalid_choice(self):
     d = parameter.choices(["1", "2", "3"])[str]._p
     with pytest.raises(ParseParameterError):
         d.validate("xyz")
コード例 #5
0
 def test_parse_str(self):
     d = parameter.choices(["1", "2", "3"])[str]._p
     assert "3" == d.parse_from_str("3")