#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Test class to test the ContainsPhoto functionality.

Created on Wed Oct 20 21:58:14 2021

@author: lmasch
"""

import unittest
import pandas as pd
import numpy as np
from code.feature_extraction.contains_photo import ContainsPhoto

class ContainsPhotoTest(unittest.TestCase):
    """Test class to test the ContainsPhoto functionality."""
    
    def setUp(self):
        """Set up the variables and examples before running the tests."""
        
        self.INPUT_COLUMN = "input"
        self.contains_photo = ContainsPhoto(self.INPUT_COLUMN)
        self.inputs = pd.DataFrame(["[https://jooinn.com/images/dramatic-landscape-7.jpg",
                                    "[]",
                                    "[empty]"])
        self.photo_values = self.contains_photo._get_values(self.inputs)
        
    def test_input_columns(self):
        """Test if the input column is correct."""
        
        self.assertListEqual(self.contains_photo._input_columns, [self.INPUT_COLUMN])
        
    def test_length(self):
        """Test if the the output array has the correct length."""
        
        output = 3
        # the output length should be 3    
        self.assertEqual(len(self.photo_values), output)


    def test_result(self):
        """Test if results are correct for different examples."""
        
        output = np.array([True, False, False]).reshape(-1,1)
        self.assertListEqual(list(self.photo_values), list(output))
        
        
if __name__ == '__main__':
    unittest.main()   

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Test class to test the ContainsPhoto functionality.

Created on Wed Oct 20 21:58:14 2021

@author: lmasch
"""

import unittest
import pandas as pd
import numpy as np
from code.feature_extraction.contains_photo import ContainsPhoto

class ContainsPhotoTest(unittest.TestCase):
    """Test class to test the ContainsPhoto functionality."""
    
    def setUp(self):
        """Set up the variables and examples before running the tests."""
        
        self.INPUT_COLUMN = "input"
        self.contains_photo = ContainsPhoto(self.INPUT_COLUMN)
        self.inputs = pd.DataFrame(["[https://jooinn.com/images/dramatic-landscape-7.jpg",
                                    "[]",
                                    "[empty]"])
        self.photo_values = self.contains_photo._get_values(self.inputs)
        
    def test_input_columns(self):
        """Test if the input column is correct."""
        
        self.assertListEqual(self.contains_photo._input_columns, [self.INPUT_COLUMN])
        
    def test_length(self):
        """Test if the the output array has the correct length."""
        
        output = 3
        # the output length should be 3    
        self.assertEqual(len(self.photo_values), output)


    def test_result(self):
        """Test if results are correct for different examples."""
        
        output = np.array([True, False, False]).reshape(-1,1)
        self.assertListEqual(list(self.photo_values), list(output))
        
        
if __name__ == '__main__':
    unittest.main()   

#!/usr/bin/env python3 # -*- coding: utf-8 -*- Test class to test the ContainsPhoto functionality.  Created on Wed Oct 20 21:58:14 2021  @author: lmasch Test class to test the ContainsPhoto functionality. Set up the variables and examples before running the tests. Test if the input column is correct. Test if the the output array has the correct length. # the output length should be 3 Test if results are correct for different examples.