def test_larger(self, capsys, count): '''When dict larger than `count`, print only `count` items''' pretty_print_head(self.dict_(20), count) out, _ = capsys.readouterr() actual = ast.literal_eval(out) assert isinstance(actual, dict) assert len(actual) == count
def test_less_or_equal(self, capsys, count): '''When dict has less or equal length than count, print whole dict''' dict_ = self.dict_(count) pretty_print_head(dict_, 20) out, _ = capsys.readouterr() actual = ast.literal_eval(out) assert actual == dict_
def test_invalid_count(self): '''When count < 1, ValueError''' with pytest.raises(ValueError): pretty_print_head(self.dict_(20), 0)