def testAddUniqueNode(self): self.assertEqual(len(list(Index.find(self.g, {"name": "Test Index 6"}))), 0) Index.new(self.g, {"name": "Test Index 6"}, unique=True) self.assertEqual(len(list(Index.find(self.g, {"name": "Test Index 6"}))), 1) Index.new(self.g, {"name": "Test Index 6"}, unique=True) self.assertEqual(len(list(Index.find(self.g, {"name": "Test Index 6"}))), 1)
def testAddUniqueNode(self): self.assertEqual( len(list(Index.find(self.g, {"name": "Test Index 6"}))), 0) Index.new(self.g, {"name": "Test Index 6"}, unique=True) self.assertEqual( len(list(Index.find(self.g, {"name": "Test Index 6"}))), 1) Index.new(self.g, {"name": "Test Index 6"}, unique=True) self.assertEqual( len(list(Index.find(self.g, {"name": "Test Index 6"}))), 1)
def testAddOrNewCompanyToIndex(self): i = Index.new(self.g, {"name": "Test Index 3"}) self.assertEqual(len(list(i.get_companies())), 0) i.add_companies([{'name': "CBS"}]) i.add_companies([{'name': "CBS"}], unique=True) self.assertEqual(len(list(i.get_companies())), 1)
def testAddedNodesWrapActualNodes(self): i = Index.new(self.g, {"name": "Test Index"}) c = i.add_companies([{"name": "Fluffer"}])[0] self.assertIsInstance(c.n, Node)
def testAddCompanyToIndex(self): i = Index.new(self.g, {"name": "Test Index 6"}) self.assertEqual(len(list(i.get_companies())), 0) i.add_companies([{'name': "CBS"}, {'name': 'ABC'}]) self.assertEqual(len(list(i.get_companies())), 2)
def testCreateAndFindIndex(self): index_name = "Test Index 4" i = Index.new(self.g, {"name": index_name}).push() ix = Index.find_one(self.g, dict(name=index_name)) self.assertEqual(i, ix)
def testCreateIndexNode(self): i = Index.new(self.g, {"name": "Test Index 2"}) self.assertIsInstance(i, Index) self.assertEqual(i.n.properties['name'], "Test Index 2")