File: TestFileWriter.py

package info (click to toggle)
uranium 5.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,304 kB
  • sloc: python: 31,765; sh: 132; makefile: 12
file content (22 lines) | stat: -rw-r--r-- 635 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from UM.FileHandler.FileWriter import FileWriter
import pytest
import io

def test_getAddToRecentFiles():
    writer = FileWriter(add_to_recent_files = True)
    assert writer.getAddToRecentFiles()

    other_writer = FileWriter(add_to_recent_files = False)
    assert not other_writer.getAddToRecentFiles()


def test_write():
    writer = FileWriter()
    with pytest.raises(Exception):
        writer.write(io.StringIO(), "Some data to write")


def test_information():
    writer = FileWriter()
    writer.setInformation("Some information about the writer")
    assert writer.getInformation() == "Some information about the writer"