def test_one_to_many(self):
     path = "bs"
     model = models.C
     result, table = walk_path(model, path)
     self.assertTrue(isinstance(result, OneToManyPathPart))
     self.assertTrue(isinstance(result.inner, ColumnPathPart))
     self.assertEqual(result.render(),
     "SELECT table_c.id FROM table_c WHERE table_c.id IN ({new_or_old}.c)")
     self.assertEqual(table, "table_b")
 def test_many_to_one(self):
     path = "c"
     model = models.B
     result, table = walk_path(model, path)
     self.assertTrue(isinstance(result, ManyToOnePathPart))
     self.assertTrue(isinstance(result.inner, ColumnPathPart))
     self.assertEqual(result.render(),
     "SELECT table_b.id FROM table_b WHERE table_b.c IN ({new_or_old}.id)")
     self.assertEqual(table, "table_c")
Beispiel #3
0
 def test_one_to_many(self):
     path = "bs"
     model = models.C
     result, table = walk_path(model, path)
     self.assertTrue(isinstance(result, OneToManyPathPart))
     self.assertTrue(isinstance(result.inner, ColumnPathPart))
     self.assertEqual(
         result.render(),
         "SELECT table_c.id FROM table_c WHERE table_c.id IN ({new_or_old}.c)"
     )
     self.assertEqual(table, "table_b")
Beispiel #4
0
 def test_many_to_one(self):
     path = "c"
     model = models.B
     result, table = walk_path(model, path)
     self.assertTrue(isinstance(result, ManyToOnePathPart))
     self.assertTrue(isinstance(result.inner, ColumnPathPart))
     self.assertEqual(
         result.render(),
         "SELECT table_b.id FROM table_b WHERE table_b.c IN ({new_or_old}.id)"
     )
     self.assertEqual(table, "table_c")
Beispiel #5
0
 def test_one_to_many_column_returns_none(self):
     path = "bs.id"
     model = models.C
     result, table = walk_path(model, path)
     self.assertTrue(result is None)
     self.assertTrue(table is None)
 def test_one_to_many_column_returns_none(self):
     path = "bs.id"
     model = models.C
     result, table = walk_path(model, path)
     self.assertTrue(result is None)
     self.assertTrue(table is None)
Beispiel #7
0
 def test_non_sqlalchemy_paths(self):
     path = "c.__tablename__"
     model = models.B
     result, table = walk_path(model, path)
     self.assertTrue(result is None)
     self.assertTrue(table is None)
Beispiel #8
0
 def test_composite_column_returns_none(self):
     path = "composite_column"
     model = models.B
     result, table = walk_path(model, path)
     self.assertTrue(result is None)
     self.assertTrue(table is None)
 def test_non_sqlalchemy_paths(self):
     path = "c.__tablename__"
     model = models.B
     result, table = walk_path(model, path)
     self.assertTrue(result is None)
     self.assertTrue(table is None)
 def test_composite_column_returns_none(self):
     path = "composite_column"
     model = models.B
     result, table = walk_path(model, path)
     self.assertTrue(result is None)
     self.assertTrue(table is None)