Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

test with python

"""Testing the methods"""


import unittest
from unittest import TestCase
from palindrome import is_palindrome
from prime_number import is_prime


class TestingFunctions(TestCase):
    """Tests to know if the methods works well"""
    
    def test_is_palindrome(self):
        """Testing is_palindrome method"""
        self.assertEqual(is_palindrome('Ligar es ser agil'), True)
        self.assertEqual(is_palindrome('Arepera'), True)
        self.assertEqual(is_palindrome('Esto no es un palindromo'), False)
        self.assertEqual(is_palindrome('ESto tampoco es un palindromo'), False)
        self.assertEqual(is_palindrome('Ana'), True)

    def test_is_prime(self):
        """Testing is_prime method"""
        self.assertEqual(is_prime(100), False)
        self.assertEqual(is_prime(200), False)
        self.assertEqual(is_prime(53), True)
        self.assertEqual(is_prime(23), True)
        self.assertEqual(is_prime(45), False)
        self.assertEqual(is_prime(32), False)
        self.assertEqual(is_prime(142), False)


if __name__ == '__main__':
    unittest.main()
Comment

python t test

# Python program to conduct two-sample
# T-test using pingouin library
 
# Importing library
from statsmodels.stats.weightstats import ttest_ind
import numpy as np
import pingouin as pg
 
# Creating data groups
data_group1 = np.array([160, 150, 160, 156.12, 163.24,
                        160.56, 168.56, 174.12,
                        167.123, 165.12])
data_group2 = np.array([157.97, 146, 140.2, 170.15,
                        167.34, 176.123, 162.35, 159.123,
                        169.43, 148.123])
 
# Conducting two-sample ttest
result = pg.ttest(data_group1,
                  data_group2,
                  correction=True)
 
# Print the result
print(result)
Comment

PREVIOUS NEXT
Code Example
Python :: create pandas dataframe 
Python :: scrape email in a list from website python 
Python :: how to click a div element in selenium python 
Python :: python show map with coordinates 
Python :: read ms word with python 
Python :: how to access http page in pythion 
Python :: run a python script from another python script on a raspberry pi 
Python :: how to append list in python 
Python :: python for continue 
Python :: how to print last element in a list python 
Python :: how to set a single main title above all the subplots with pyplot 
Python :: python print function 
Python :: tkinter canvas text size 
Python :: Got AttributeError when attempting to get a value for field `name` on serializer 
Python :: python enum to int 
Python :: python lowercase first letter 
Python :: sum of array in python 
Python :: find keys to minimum value in dict 
Python :: regex find email address in string python 
Python :: add a column with fixed value pandas 
Python :: making your own range function in python 
Python :: print example 
Python :: raw input python 
Python :: convert str to datetime 
Python :: check if number is prime python 
Python :: python trim 
Python :: python add 1 to 100 
Python :: how to slice dataframe by timestamp 
Python :: python log file 
Python :: python excel file 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =