Improving functionalities and adding unit tests
This commit is contained in:
@@ -57,7 +57,8 @@ def sample_structure():
|
||||
"Path 'div[class=a long attr]':\n\tAttribute 'class' does not start with 'different start': actual='a long attr', expected ='different start'."),
|
||||
(Div(cls="a long attr"), Div(cls=Contains("not included")),
|
||||
"Path 'div[class=a long attr]':\n\tAttribute 'class' does not contain 'not included': actual='a long attr', expected ='not included'."),
|
||||
|
||||
(Div(cls="a long attr"), Div(cls=DoesNotContain("long attr")),
|
||||
"Path 'div[class=a long attr]':\n\tAttribute 'class' does contain 'long attr' while it must not: actual='a long attr'."),
|
||||
])
|
||||
def test_matches_error_expected(value, expected, expected_error):
|
||||
with pytest.raises(AssertionError) as error:
|
||||
@@ -75,6 +76,7 @@ def test_matches_error_expected(value, expected, expected_error):
|
||||
(Div(), Div(Empty)),
|
||||
(Div(cls="a long attr"), Div(cls=StartsWith("a long"))),
|
||||
(Div(cls="a long attr"), Div(cls=Contains("long"))),
|
||||
(Div(cls="a long attr"), Div(cls=DoesNotContain("xxxx"))),
|
||||
])
|
||||
def test_matches_success_expected(value, expected):
|
||||
assert matches(value, expected)
|
||||
|
||||
Reference in New Issue
Block a user