Пример #1
0
    def test_files_that_are_different_with_one_line(self):
        file_with_one_line = File(FileContent("test.csv", [TEST_DATA1]))
        different_file = File(FileContent("test.csv", [TEST_DATA3]))
        sut = FileComparer(file_with_one_line, different_file)

        got = sut.compare()

        want = FileContent(OUTPUT_FILE_NAME, [TEST_DATA3])
        assert got == want
Пример #2
0
    def test_files_that_are_the_same_with_multiple_lines(self):
        file_with_multiple_lines = File(
            FileContent("test.csv", [TEST_DATA1, TEST_DATA2])
        )
        same_file = File(
            FileContent("test.csv", [TEST_DATA1, TEST_DATA2])
        )
        sut = FileComparer(file_with_multiple_lines, same_file)

        got = sut.compare()

        want = FileContent(OUTPUT_FILE_NAME, [])
        assert got == want
Пример #3
0
    def test_converting_multiple_lines_to_a_dictionary(self):
        content = FileContent("test.csv", [TEST_DATA1, TEST_DATA2])
        sut = File(content)

        got = sut.lines

        want = {TEST_HASH1: TEST_DATA1.strip(), TEST_HASH2: TEST_DATA2.strip()}
        assert got == want
Пример #4
0
    def test_converting_an_empty_file_to_a_dictionary(self):
        content = FileContent("test.csv", [])
        sut = File(content)

        got = sut.lines

        want = {}
        assert got == want