Ejemplo n.º 1
0
def test_file_entry_equality():
    a = FileEntry(os.path.join(temp_dir, '0'), "data/54231/12345")
    b = FileEntry(os.path.join(temp_dir, '0'), "data/54231/12345")
    c = FileEntry(os.path.join(temp_dir, '1'), "data/67890/09876")

    assert_really_equal(a, b)
    assert_really_not_equal(a, c)

    assert_equal(NotImplemented, a.__eq__(1))
    assert_equal(NotImplemented, a.__ne__(1))
Ejemplo n.º 2
0
def test_manifest_equality():
    tree = Tree(DirectoryEntry.for_directory(temp_dir), [])
    expected_entries = { e.path: e for d in tree for e in d }
    expected_name = 'manifest/hostname/username/2013-03-18T15:33:50.122018'
    expected = Manifest(expected_name, expected_entries)

    with patch("tardis.manifest.iso8601") as iso8601:
        iso8601.return_value = '2013-03-18T15:33:50.122018'
        assert_really_equal(expected, Manifest.from_filesystem('hostname', 'username', [temp_dir]))

    with patch("tardis.manifest.iso8601") as iso8601:
        iso8601.return_value = '2013-03-24T00:00:00.000000'
        assert_really_not_equal(expected, Manifest.from_filesystem('hostname', 'username', [temp_dir]))

    assert_equal(NotImplemented, expected.__eq__(1))
    assert_equal(NotImplemented, expected.__ne__(1))