<s> from py2neo import Node <EOL> from test . util import GraphTestCase <EOL> class FindTestCase ( GraphTestCase ) : <EOL> def test_will_find_no_nodes_with_non_existent_label ( self ) : <EOL> label = next ( self . unique_string ) <EOL> nodes = list ( self . graph . find ( label ) ) <EOL> assert nodes == [ ] <EOL> def test_can_find_nodes_with_label ( self ) : <EOL> label = next ( self . unique_string ) <EOL> alice = Node ( label , name = "<STR_LIT>" ) <EOL> self . graph . create ( alice ) <EOL> nodes = list ( self . graph . find ( label ) ) <EOL> assert alice in nodes <EOL> def test_can_find_nodes_with_label_and_property ( self ) : <EOL> label = next ( self . unique_string ) <EOL> alice = Node ( label , name = "<STR_LIT>" ) <EOL> self . graph . create ( alice ) <EOL> nodes = list ( self . graph . find ( label , "<STR_LIT:name>" , "<STR_LIT>" ) ) <EOL> assert alice in nodes <EOL> def test_can_find_nodes_with_label_and_one_of_several_property_values ( self ) : <EOL> label = next ( self . unique_string ) <EOL> alice = Node ( label , name = "<STR_LIT>" ) <EOL> bob = Node ( label , name = "<STR_LIT>" ) <EOL> carol = Node ( label , name = "<STR_LIT>" ) <EOL> self . graph . create ( alice | bob | carol ) <EOL> nodes = list ( self . graph . find ( label , "<STR_LIT:name>" , ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ) ) <EOL> assert alice in nodes <EOL> assert bob in nodes <EOL> assert carol in nodes <EOL> def test_cannot_find_empty_label ( self ) : <EOL> with self . assertRaises ( ValueError ) : <EOL> list ( self . graph . find ( "<STR_LIT>" ) ) <EOL> class FindOneTestCase ( GraphTestCase ) : <EOL> def test_can_find_one_node_with_label_and_property ( self ) : <EOL> label = next ( self . unique_string ) <EOL> name = next ( self . unique_string ) <EOL> thing = Node ( label , name = name ) <EOL> self . graph . create ( thing ) <EOL> found = self . graph . find_one ( label , "<STR_LIT:name>" , name ) <EOL> assert found is thing <EOL> def test_should_find_none_if_no_match ( self ) : <EOL> label = next ( self . unique_string ) <EOL> name = next ( self . unique_string ) <EOL> found = self . graph . find_one ( label , "<STR_LIT:name>" , name ) <EOL> assert found is None </s>
