コード例 #1
0
ファイル: test_lp_reader.py プロジェクト: nandi6uc/flipy
    def test_parse_term_exceptions(self):
        with pytest.raises(Exception) as e:
            LpReader._parse_term(' -5 5x')
        assert str(
            e.value
        ) == "variable '5x' does not have a valid name: A variable name should not begin with a number or a period"

        with pytest.raises(Exception) as e:
            LpReader._parse_term(' -5 x y')
        assert str(
            e.value
        ) == "variable 'x y' does not have a valid name: A variable name should not have whitespaces"

        with pytest.raises(Exception) as e:
            LpReader._parse_term(' -5 x😂')
        assert str(e.value) == "variable 'x😂' does not have a valid name"
コード例 #2
0
ファイル: test_lp_reader.py プロジェクト: nandi6uc/flipy
 def test_parse_term(self, term, expected):
     assert LpReader._parse_term(term) == expected