@@ -64,12 +64,12 @@ def test_key_operations_for_store(self):
64
64
sk = nilql .SecretKey .generate (cluster , {'store' : True })
65
65
sk_loaded = nilql .SecretKey .load (sk .dump ())
66
66
self .assertTrue (isinstance (sk , nilql .SecretKey ))
67
- self .assertTrue ( sk == sk_loaded )
67
+ self .assertEqual ( sk_loaded , sk )
68
68
69
69
sk_from_json = nilql .SecretKey .load (
70
70
json .loads (json .dumps (sk .dump ()))
71
71
)
72
- self .assertTrue ( sk == sk_from_json )
72
+ self .assertEqual ( sk_from_json , sk )
73
73
74
74
def test_key_operations_for_match (self ):
75
75
"""
@@ -79,12 +79,12 @@ def test_key_operations_for_match(self):
79
79
sk = nilql .SecretKey .generate (cluster , {'match' : True })
80
80
sk_loaded = nilql .SecretKey .load (sk .dump ())
81
81
self .assertTrue (isinstance (sk , nilql .SecretKey ))
82
- self .assertTrue ( sk == sk_loaded )
82
+ self .assertEqual ( sk_loaded , sk )
83
83
84
84
sk_from_json = nilql .SecretKey .load (
85
85
json .loads (json .dumps (sk .dump ()))
86
86
)
87
- self .assertTrue ( sk == sk_from_json )
87
+ self .assertEqual ( sk_from_json , sk )
88
88
89
89
def test_key_operations_for_sum_with_single_node (self ):
90
90
"""
@@ -94,37 +94,37 @@ def test_key_operations_for_sum_with_single_node(self):
94
94
sk = nilql .SecretKey .generate ({'nodes' : [{}]}, {'sum' : True })
95
95
sk_loaded = nilql .SecretKey .load (sk .dump ())
96
96
self .assertTrue (isinstance (sk , nilql .SecretKey ))
97
- self .assertTrue ( sk == sk_loaded )
97
+ self .assertEqual ( sk_loaded , sk )
98
98
99
99
sk_from_json = nilql .SecretKey .load (
100
100
json .loads (json .dumps (sk .dump ()))
101
101
)
102
- self .assertTrue ( sk == sk_from_json )
102
+ self .assertEqual ( sk_from_json , sk )
103
103
104
104
pk = nilql .PublicKey .generate (sk )
105
105
pk_loaded = nilql .PublicKey .load (pk .dump ())
106
106
self .assertTrue (isinstance (pk , nilql .PublicKey ))
107
- self .assertTrue ( pk == pk_loaded )
107
+ self .assertEqual ( pk_loaded , pk )
108
108
109
109
pk_from_json = nilql .PublicKey .load (
110
110
json .loads (json .dumps (pk .dump ()))
111
111
)
112
- self .assertTrue ( pk == pk_from_json )
112
+ self .assertEqual ( pk_from_json , pk )
113
113
114
114
def test_key_operations_for_sum_with_multiple_nodes (self ):
115
115
"""
116
- Test key generate, dump, JSONify, and load for store operation
116
+ Test key generate, dump, JSONify, and load for sum operation
117
117
with multiple nodes.
118
118
"""
119
119
sk = nilql .SecretKey .generate ({'nodes' : [{}, {}, {}]}, {'sum' : True })
120
120
sk_loaded = nilql .SecretKey .load (sk .dump ())
121
121
self .assertTrue (isinstance (sk , nilql .SecretKey ))
122
- self .assertTrue ( sk == sk_loaded )
122
+ self .assertEqual ( sk_loaded , sk )
123
123
124
124
sk_from_json = nilql .SecretKey .load (
125
125
json .loads (json .dumps (sk .dump ()))
126
126
)
127
- self .assertTrue ( sk == sk_from_json )
127
+ self .assertEqual ( sk_from_json , sk )
128
128
129
129
def test_key_from_seed_for_store_with_single_node (self ):
130
130
"""
@@ -257,11 +257,11 @@ def test_encrypt_decrypt_for_store(self):
257
257
258
258
plaintext = 123
259
259
decrypted = nilql .decrypt (sk , nilql .encrypt (sk , plaintext ))
260
- self .assertTrue ( plaintext == decrypted )
260
+ self .assertEqual ( decrypted , plaintext )
261
261
262
262
plaintext = 'abc'
263
263
decrypted = nilql .decrypt (sk , nilql .encrypt (sk , plaintext ))
264
- self .assertTrue ( plaintext == decrypted )
264
+ self .assertEqual ( decrypted , plaintext )
265
265
266
266
def test_encrypt_for_match (self ):
267
267
"""
@@ -274,9 +274,9 @@ def test_encrypt_for_match(self):
274
274
ciphertext_three = nilql .encrypt (sk , 'abc' )
275
275
ciphertext_four = nilql .encrypt (sk , 'abc' )
276
276
ciphertext_five = nilql .encrypt (sk , 'ABC' )
277
- self .assertTrue (ciphertext_one == ciphertext_two )
278
- self .assertTrue (ciphertext_three == ciphertext_four )
279
- self .assertTrue (ciphertext_four != ciphertext_five )
277
+ self .assertEqual (ciphertext_one , ciphertext_two )
278
+ self .assertEqual (ciphertext_three , ciphertext_four )
279
+ self .assertNotEqual (ciphertext_four , ciphertext_five )
280
280
281
281
def test_encrypt_decrypt_of_int_for_sum_single (self ):
282
282
"""
@@ -287,7 +287,7 @@ def test_encrypt_decrypt_of_int_for_sum_single(self):
287
287
plaintext = 123
288
288
ciphertext = nilql .encrypt (pk , plaintext )
289
289
decrypted = nilql .decrypt (sk , ciphertext )
290
- self .assertTrue ( plaintext == decrypted )
290
+ self .assertEqual ( decrypted , plaintext )
291
291
292
292
def test_encrypt_decrypt_of_int_for_sum_multiple (self ):
293
293
"""
@@ -297,7 +297,7 @@ def test_encrypt_decrypt_of_int_for_sum_multiple(self):
297
297
plaintext = 123
298
298
ciphertext = nilql .encrypt (sk , plaintext )
299
299
decrypted = nilql .decrypt (sk , ciphertext )
300
- self .assertTrue ( plaintext == decrypted )
300
+ self .assertEqual ( decrypted , plaintext )
301
301
302
302
class TestCiphertextRepresentations (TestCase ):
303
303
"""
@@ -313,7 +313,7 @@ def test_ciphertext_representation_for_store_with_multiple_nodes(self):
313
313
plaintext = 'abc'
314
314
ciphertext = ['Ifkz2Q==' , '8nqHOQ==' , '0uLWgw==' ]
315
315
decrypted = nilql .decrypt (ck , ciphertext )
316
- self .assertTrue ( plaintext == decrypted )
316
+ self .assertEqual ( decrypted , plaintext )
317
317
318
318
def test_ciphertext_representation_for_sum_with_multiple_nodes (self ):
319
319
"""
@@ -325,7 +325,7 @@ def test_ciphertext_representation_for_sum_with_multiple_nodes(self):
325
325
plaintext = 123
326
326
ciphertext = [456 , 246 , 4294967296 + 15 - 123 - 456 ]
327
327
decrypted = nilql .decrypt (ck , ciphertext )
328
- self .assertTrue ( plaintext == decrypted )
328
+ self .assertEqual ( decrypted , plaintext )
329
329
330
330
class TestFunctionsErrors (TestCase ):
331
331
"""
@@ -468,4 +468,4 @@ def test_workflow_for_secure_sum_with_multiple_nodes(self):
468
468
(c0 + c1 + c2 ) % (2 ** 32 + 15 )
469
469
)
470
470
decrypted = nilql .decrypt (sk , [a3 , b3 , c3 ])
471
- self .assertTrue (decrypted == 123 + 456 + 789 )
471
+ self .assertEqual (decrypted , 123 + 456 + 789 )
0 commit comments