Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shnela committed Oct 31, 2022
1 parent 2145ce3 commit 8663139
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 24 deletions.
1 change: 0 additions & 1 deletion src/neptune/new/types/atoms/file.py
Expand Up @@ -26,7 +26,6 @@
Union,
)

from neptune.new.exceptions import NeptuneException
from neptune.new.internal.utils import verify_type
from neptune.new.internal.utils.images import (
get_html_content,
Expand Down
21 changes: 0 additions & 21 deletions tests/neptune/new/internal/utils/test_images.py
Expand Up @@ -19,7 +19,6 @@
import sys
import unittest
from typing import Optional
from unittest import mock
from uuid import uuid4

import altair as alt
Expand Down Expand Up @@ -250,26 +249,6 @@ def test_get_html_from_pandas(self):
result.startswith('<table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">')
)

def test_get_oversize_html_from_pandas(self):
# given
table = mock.Mock(spec=pandas.DataFrame)
table.to_html.return_value = 40_000_000 * "a"

# when
with self.assertLogs() as caplog:
result = get_html_content(table)

# then
self.assertIsNone(result)
self.assertEqual(
caplog.output,
[
"WARNING:neptune.new.internal.utils.limits:You are attempting to create an in-memory file that"
" is 38.1MB large. Neptune supports logging in-memory file objects smaller than 32MB."
" Resize or increase compression of this object"
],
)

@staticmethod
def _encode_pil_image(image: Image) -> bytes:
with io.BytesIO() as image_buffer:
Expand Down
5 changes: 3 additions & 2 deletions tests/neptune/new/types/atoms/test_file.py
Expand Up @@ -45,8 +45,8 @@ def test_file_constructor(self):
self.assertEqual(file1.extension, file2.extension)
self.assertEqual(file1.file_type, file2.file_type)

def _test_local_file(self, path: str, expected_ext: str):
file = File.from_path(path)
def _test_local_file(self, path: str, expected_ext: str, custom_ext=None):
file = File.from_path(path, extension=custom_ext)
self.assertIs(file.file_type, FileType.LOCAL_FILE)
self.assertEqual(path, file.path)
with self.assertRaises(NeptuneException):
Expand All @@ -59,6 +59,7 @@ def test_create_from_path(self):
self._test_local_file("some/path.ext", expected_ext="ext")
self._test_local_file("some/path.txt.ext", expected_ext="ext")
self._test_local_file("so.me/path", expected_ext="")
self._test_local_file("some/path.ext", expected_ext="txt", custom_ext="txt")

@staticmethod
def _save_and_return_content(file: File):
Expand Down

0 comments on commit 8663139

Please sign in to comment.