def test_ne_json_2(self): with raises_if(self, self.db.provider.dialect == 'Oracle', TranslationError, "Oracle does not support comparison of json structures: p.info['os'] != Json({})"): p = get(p for p in self.Product if p.info['os'] != Json({})) self.assertTrue(p) p = get(p for p in self.Product if p.info['os'] != {'type': 'iOS', 'version': '8'}) self.assertFalse(p)
def test_equal_empty_list_2(self): with raises_if( self, db.provider.dialect == 'Oracle', TranslationError, "Oracle does not support comparison of json structures: p.info['colors'] == Json([])" ): p = get(p for p in Product if p.info['colors'] == Json([])) self.assertIsNone(p)
def test_ne_empty_list(self): with raises_if( self, self.db.provider.dialect == 'Oracle', TranslationError, "Oracle does not support comparison of json structures: p.info['colors'] != Json([])" ): p = get(p for p in self.Product if p.info['colors'] != Json([])) self.assertTrue(p)
def test_equal_list_4(self): colors = ['Gold', 'Silver', 'Space Gray'] with raises_if( self, db.provider.dialect == 'Oracle', TranslationError, "Oracle does not support comparison of json structures: p.info['colors'] == Json(colors)" ): p = get(p for p in Product if p.info['colors'] == Json(colors)) self.assertTrue(p)