-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from lucc/nullable-properties
Nullable properties
- Loading branch information
Showing
4 changed files
with
144 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,18 +105,28 @@ def test_and_queries_match_after_sorting(self): | |
|
||
|
||
class TestFieldQuery(unittest.TestCase): | ||
@unittest.expectedFailure | ||
def test_empty_field_values_match_if_the_field_is_present(self): | ||
# This test currently fails because the Contact class has all | ||
# attributes set because they are properties. So the test in the query | ||
# class if an attribute is present never fails. | ||
def test_empty_field_values_match_if_sstring_field_is_present(self): | ||
uid = "Some Test Uid" | ||
vcard1 = TestContact(uid=uid) | ||
vcard2 = TestContact() | ||
query = FieldQuery("uid", "") | ||
self.assertTrue(query.match(vcard1)) | ||
self.assertFalse(query.match(vcard2)) | ||
|
||
def test_empty_field_values_match_if_list_field_is_present(self): | ||
vcard1 = TestContact(categories=["foo", "bar"]) | ||
vcard2 = TestContact() | ||
query = FieldQuery("categories", "") | ||
self.assertTrue(query.match(vcard1)) | ||
self.assertFalse(query.match(vcard2)) | ||
|
||
def test_empty_field_values_match_if_dict_field_is_present(self): | ||
query = FieldQuery("emails", "") | ||
vcard = TestContact() | ||
self.assertFalse(query.match(vcard)) | ||
vcard.add_email("home", "[email protected]") | ||
self.assertTrue(query.match(vcard)) | ||
|
||
def test_empty_field_values_fails_if_the_field_is_absent(self): | ||
vcard = TestContact() | ||
query = FieldQuery("emails", "") | ||
|
Oops, something went wrong.