def test_execute_with_dpsu(self): schema_dpsu = copy.copy(schema) schema_dpsu["PUMS.PUMS"].use_dpsu = True reader = PandasReader(df, schema_dpsu) private_reader = PrivateReader(reader, schema_dpsu, 1.0) assert (private_reader._options.use_dpsu == True) query = QueryParser(schema_dpsu).queries( "SELECT COUNT(*) AS c FROM PUMS.PUMS GROUP BY married")[0] assert (private_reader._get_reader(query) is not private_reader.reader)
def test_execute_without_dpsu(self): schema_no_dpsu = copy.copy(schema) schema_no_dpsu["PUMS.PUMS"].use_dpsu = False reader = PandasReader(df, schema_no_dpsu) private_reader = PrivateReader(reader, schema_no_dpsu, privacy=Privacy(epsilon=1.0)) assert (private_reader._options.use_dpsu == False) query = QueryParser(schema_no_dpsu).queries( "SELECT COUNT(*) AS c FROM PUMS.PUMS GROUP BY married")[0] assert (private_reader._get_reader(query) is private_reader.reader)