@@ -24,12 +24,20 @@ def test_binary_file():
24
24
expect_selfie (data ).to_be_file ("test_binary.bin" )
25
25
26
26
27
- def test_binary_file_duplicate ():
27
+ def test_binary_file_duplicate_equal ():
28
28
"""Test writing same binary data to a file multiple times"""
29
- data = b"same data"
30
- expect_selfie (data ).to_be_file ("duplicate.bin" )
31
- expect_selfie (data ).to_be_file ("duplicate.bin" )
29
+ expect_selfie (b"equal" ).to_be_file ("duplicate_equal.bin" )
30
+ expect_selfie (b"equal" ).to_be_file ("duplicate_equal.bin" )
32
31
32
+ def test_binary_file_duplicate_unequal ():
33
+ """Test writing same binary data to a file multiple times"""
34
+ try :
35
+ expect_selfie (b"a" ).to_be_file ("duplicate_unequal.bin" )
36
+ expect_selfie (b"b" ).to_be_file ("duplicate_unequal.bin" )
37
+ except AssertionError as e :
38
+ expect_selfie (str (e )).to_be ("""Snapshot mismatch, TODO: string comparison
39
+ - update this snapshot by adding `_TODO` to the function name
40
+ - update all snapshots in this file by adding """ )
33
41
34
42
def test_binary_file_mismatch ():
35
43
"""Test error handling for mismatched binary data"""
@@ -48,16 +56,6 @@ def test_base64_mismatch():
48
56
"""Test error handling for mismatched base64 data"""
49
57
data = b"test data"
50
58
encoded = base64 .b64encode (b"different data" ).decode ()
51
- with pytest .raises (AssertionError ):
52
- expect_selfie (data ).to_be_base64 (encoded )
53
-
54
-
55
- def test_readonly_mode_todo ():
56
- """Test error handling in readonly mode for TODO methods"""
57
- from selfie_lib import _selfieSystem
58
-
59
- print (f"Current mode: { _selfieSystem ().mode } " )
60
- print (f"SELFIE env var: { os .getenv ('SELFIE' )} " )
61
59
with pytest .raises (AssertionError ) as exc_info :
62
- expect_selfie (b"test" ). to_be_base64_TODO ( )
63
- assert "readonly mode" in str (exc_info .value ). lower ( )
60
+ expect_selfie (data ). to_be_base64 ( "dGVzdCBkYXRh" )
61
+ expect_selfie ( str (exc_info .value )). to_be_TODO ( "Error while parsing the literal at File: /Users/ntwigg/Documents/dev/selfie/python/example-pytest-selfie/tests/binary_test.py, Line: 60. Please report this error at https://github.com/diffplug/selfie" )
0 commit comments