blob: 3d4becae97af4225f3da290145a0dc1df3f494be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# ############################################################################ #
# #
# ::: :::::::: #
# test_captured.py :+: :+: :+: #
# +:+ +:+ +:+ #
# By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/03/01 15:55:11 by cacharle #+# #+# #
# Updated: 2021/03/02 10:14:23 by cacharle ### ########.fr #
# #
# ############################################################################ #
import pytest
import copy
from minishell_test.test.captured import CapturedCommand, CapturedTimeout
@pytest.fixture
def captured():
return CapturedCommand("foo", 0, ["file1", "file2"])
def test_init(captured):
assert "foo" == captured.output
assert 0 == captured.status
assert ["file1", "file2"] == captured.files_content
def test_eq(captured):
assert captured != 42
assert captured != "bonjour"
assert captured == captured
c2 = copy.deepcopy(captured)
assert captured == c2
c2.output = "bar"
assert captured != c2
c2 = copy.deepcopy(captured)
c2.status = 42
assert captured != c2
c2 = copy.deepcopy(captured)
c2.files_content = ["asdfasdf"]
assert captured != c2
assert captured != CapturedTimeout()
assert CapturedTimeout() == CapturedTimeout()
|