Skip to content

Commit e6c22ee

Browse files
committed
test_miguel
1 parent bb179d6 commit e6c22ee

4 files changed

Lines changed: 64 additions & 0 deletions

File tree

test/test_convert_to_numeric.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import pandas as pd
2+
from to_numeric import convert_to_numeric
3+
4+
def test_convert_to_numeric():
5+
6+
df = pd.DataFrame({'A': ['1', '2', '3'], 'B': ['4.5', '5.6', '6.7'], 'C': ['a', 'b', 'c']})
7+
8+
9+
convert_to_numeric(df, 'A')
10+
11+
12+
assert df['A'][0],int

test/test_heatmap_corr.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import numpy as np
2+
import matplotlib.pyplot as plt
3+
import seaborn as sns
4+
import pandas as pd
5+
from heatmap_corr import heatmap
6+
7+
def test_heatmap():
8+
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': [7, 8, 9], 'target': [10, 20, 30]})
9+
10+
heatmap(df, 2, 'target', None)
11+
12+
13+

test/test_scrap.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from selenium import webdriver
2+
from selenium.webdriver.common.by import By
3+
import requests
4+
from bs4 import BeautifulSoup
5+
from selenium import webdriver
6+
import os
7+
import time
8+
import io
9+
from PIL import Image
10+
from scrap import image_scrap
11+
import shutil
12+
13+
14+
def test_image_scrap():
15+
url = 'https://www.google.com/search?q=perros+bonitos&tbm=isch&ved=2ahUKEwiCpOG3z6n9AhVFV6QEHY7KBa0Q2-cCegQIABAA&oq=perros+bonitos&gs_lcp=CgNpbWcQAzIFCAAQgAQyBQgAEIAEMgUIABCABDIFCAAQgAQyBQgAEIAEMgUIABCABDIFCAAQgAQyBAgAEB4yBAgAEB4yBAgAEB5QwAlY6hFg6hJoAHAAeACAAYgBiAHJBpIBAzcuMpgBAKABAaoBC2d3cy13aXotaW1nwAEB&sclient=img&ei=YUz2Y8LvFMWukdUPjpWX6Ao&bih=849&biw=1600&rlz=1C5CHFA_enCA951CA951'
16+
n = 5
17+
image_scrap(url,n)
18+
19+
download_dir = './my_images'
20+
21+
assert os.path.exists(download_dir)
22+
assert len(os.listdir(download_dir)) == n
23+
24+
shutil.rmtree(download_dir)

test/test_sunburst.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from sunburst import sunburst
2+
import plotly.graph_objs as go
3+
import plotly.express as px
4+
5+
def test_sunburst():
6+
df = {
7+
'Category': ['Fruit', 'Fruit', 'Vegetable', 'Vegetable', 'Vegetable'],
8+
'Subcategory': ['Apple', 'Orange', 'Carrot', 'Tomato', 'Cucumber'],
9+
'Value': [20, 30, 40, 15, 25] }
10+
11+
fig = sunburst(df, 'Category', 'Subcategory', 'Value', 'My Sunburst Chart')
12+
13+
assert fig.layout.title.text == 'My Sunburst Chart'
14+
assert fig.layout.width == 800
15+
assert fig.layout.height == 600

0 commit comments

Comments
 (0)