示例#1
0
 def test_has_lt_gt(self):
     stream = yield V(self.jon).out_step().has(
         Course.get_property_by_name("credits"), 5.0, GREATER_THAN).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     stream = yield V(self.jon).out_step().has(
         Course.get_property_by_name("credits"), 5.0, LESS_THAN).get()
     results = yield stream.read()
     self.assertEqual(len(results), 0)
 def test_has_id(self):
     stream = yield V(self.jon).out_step().has_id(self.dist_dev.id).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0], self.dist_dev)
     # This should work...
     stream = yield V(self.jon).out_step().has_id(self.dist_dev.id,
                                                  self.beekeeping.id).get()
     results = yield stream.read()
示例#3
0
 def test_has_label(self):
     stream = yield V(self.jon).out_step().has_label(
         ResearchGroup.get_label()).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0], self.dist_dev)
     stream = yield V(self.jon).out_step().has_label(
         ResearchGroup.get_label(), Course.get_label()).get()
     results = yield stream.read()
     self.assertEqual(len(results), 2)
     self.assertIn(self.dist_dev, results)
     self.assertIn(self.beekeeping, results)
示例#4
0
 def test_in_labels(self):
     stream = yield V(self.jon).in_step(TaughtBy).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0].name, "Physics 264")
     stream = yield V(self.jon).in_step(SupervisedBy).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0].name, "Eric")
     stream = yield V(self.jon).in_step(SupervisedBy, TaughtBy).get()
     results = yield stream.read()
     self.assertEqual(len(results), 2)
     self.assertIn(self.physics, results)
     self.assertIn(self.eric, results)
示例#5
0
 def test_out_labels(self):
     stream = yield V(self.jon).out_step(EnrolledIn).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0].name, "Beekeeping")
     stream = yield V(self.jon).out_step(BelongsTo).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0].name, "Distributed Development")
     stream = yield V(self.jon).out_step(BelongsTo, EnrolledIn).get()
     results = yield stream.read()
     self.assertEqual(len(results), 2)
     self.assertIn(self.dist_dev, results)
     self.assertIn(self.beekeeping, results)
示例#6
0
 def test_has(self):
     # IDK about this whole get property by name thing
     stream = yield V(self.jon).out_step().has(
         ResearchGroup.get_property_by_name("name"),
         "Distributed Development").get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0], self.dist_dev)
示例#7
0
 def test_other_v(self):
     stream = yield V(self.jon).both_e().other_v().get()
     results = yield stream.read()
     self.assertEqual(len(results), 4)
     self.assertIn(self.beekeeping, results)
     self.assertIn(self.dist_dev, results)
     self.assertIn(self.eric, results)
     self.assertIn(self.physics, results)
示例#8
0
 def test_both_labels(self):
     stream = yield V(self.jon).both(EnrolledIn).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0].name, "Beekeeping")
     stream = yield V(self.jon).both(BelongsTo).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0].name, "Distributed Development")
     stream = yield V(self.jon).both(BelongsTo, EnrolledIn).get()
     results = yield stream.read()
     self.assertEqual(len(results), 2)
     self.assertIn(self.dist_dev, results)
     self.assertIn(self.beekeeping, results)
     stream = yield V(self.jon).both(TaughtBy).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0].name, "Physics 264")
     stream = yield V(self.jon).both(SupervisedBy).get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertEqual(results[0].name, "Eric")
     stream = yield V(self.jon).both(SupervisedBy, TaughtBy).get()
     results = yield stream.read()
     self.assertEqual(len(results), 2)
     self.assertIn(self.physics, results)
     self.assertIn(self.eric, results)
     stream = yield V(self.jon).both(SupervisedBy, TaughtBy, BelongsTo,
                                     EnrolledIn).get()
     results = yield stream.read()
     self.assertEqual(len(results), 4)
     self.assertIn(self.physics, results)
     self.assertIn(self.eric, results)
     self.assertIn(self.dist_dev, results)
     self.assertIn(self.beekeeping, results)
示例#9
0
 def test_in_e(self):
     stream = yield V(self.jon).in_e().get()
     results = yield stream.read()
     self.assertTrue(len(results), 2)
     self.assertIn(self.jon_eric, results)
     self.assertIn(self.jon_physics, results)
     stream = yield V(self.jon).in_e(SupervisedBy).get()
     results = yield stream.read()
     self.assertTrue(len(results), 1)
     self.assertIn(self.jon_eric, results)
     stream = yield V(self.jon).in_e(TaughtBy).get()
     results = yield stream.read()
     self.assertTrue(len(results), 1)
     self.assertIn(self.jon_physics, results)
     stream = yield V(self.jon).in_e(SupervisedBy, TaughtBy).get()
     results = yield stream.read()
     self.assertTrue(len(results), 2)
     self.assertIn(self.jon_eric, results)
     self.assertIn(self.jon_physics, results)
示例#10
0
 def test_out_e(self):
     stream = yield V(self.jon).out_e().get()
     results = yield stream.read()
     self.assertTrue(len(results), 2)
     self.assertIn(self.jon_in_dist_dev, results)
     self.assertIn(self.jon_in_beekeeping, results)
     stream = yield V(self.jon).out_e(BelongsTo).get()
     results = yield stream.read()
     self.assertTrue(len(results), 1)
     self.assertIn(self.jon_in_dist_dev, results)
     stream = yield V(self.jon).out_e(EnrolledIn).get()
     results = yield stream.read()
     self.assertTrue(len(results), 1)
     self.assertIn(self.jon_in_beekeeping, results)
     stream = yield V(self.jon).out_e(EnrolledIn, BelongsTo).get()
     results = yield stream.read()
     self.assertTrue(len(results), 2)
     self.assertIn(self.jon_in_dist_dev, results)
     self.assertIn(self.jon_in_beekeeping, results)
示例#11
0
 def setUp(self):
     super(SimpleQueryTest, self).setUp()
     self.q = V(MockVertex())
示例#12
0
 def test_both_v(self):
     stream = yield V(self.blake).out_e().both_v().get()
     results = yield stream.read()
     self.assertEqual(len(results), 2)
     self.assertIn(self.theoretics, results)
     self.assertIn(self.blake, results)
示例#13
0
 def test_out_v(self):
     stream = yield V(self.blake).in_e().out_v().get()
     results = yield stream.read()
     self.assertEqual(len(results), 1)
     self.assertIn(self.beekeeping, results)
示例#14
0
 def test_both(self):
     stream = yield V(self.jon).both().get()
     results = yield stream.read()
     self.assertIn(self.physics, results)
     self.assertIn(self.beekeeping, results)
示例#15
0
 def test_in(self):
     stream = yield V(self.jon).in_step().get()
     results = yield stream.read()
     self.assertIn(self.physics, results)
     self.assertIn(self.eric, results)
示例#16
0
 def test_out_step(self):
     stream = yield V(self.jon).out_step().get()
     results = yield stream.read()
     self.assertIn(self.beekeeping, results)