def test_add(): """Sample test function""" assert sample.add(1, 1) == 2 assert sample.add(0, 1) != 2
def test_add(): assert add(1,2) == 3
def test_if(self): import sample value = sample.add(1, 1) self.assertEqual(2, value)
def test_invalid_arg1(): actual = add(None, 1)
def test_add_one(): assert 30 == add(10,20) assert 40 == add(22,18)
def test_add_lists(self): result = add([3], [5]) self.assertEquals([3, 5], result)
def test_add(self): assert sample.add(1, 2) == 3 assert sample.add(-1, 2) == 1 assert sample.add(1, -2) == -1 assert sample.add(-1, -2) == -3
import numpy as np import open3d as o3 import sys import sample print("hello") a = 200 + 400 print(a) arr = np.array([1,3,5]) print(arr) print(sys.version) print("cnt",sample.get()) print(sample.add(3,5)) print("cnt",sample.get()) print(sample.add(103,5)) print("cnt",sample.get())
def test_sample(): assert add(2, 5) == 7
def test_new_delimeter(): assert add("//X\n1X2") == 3 assert add("//-\n1-2-3") == 6
def test_single_num(): assert add("1") == 1 assert add("83") == 83
def test_empty_string(): assert add("") == 0
def test_negatives(): with pytest.raises(Exception, match=r"Negatives not allowed: -1"): add("-1,2") with pytest.raises(Exception, match=r"Negatives not allowed: -4,-5"): add("2,-4,3,-5")
def test_ignore_big_num(): assert add("1001,2,3") == 5 assert add("1000,2,3") == 1005
def test_add_integers(self): result = add(3, 5) self.assertEquals(8, result)
def test_add(self): self.assertEqual(sample.add(10, 5), 15) self.assertEqual(sample.add(-1, 1), 0) self.assertEqual(sample.add(-1, -1), -2)
def test_add_num(self): assert add(1, 2) == 3
def test_newline_delimeter(): assert add("1\n2,3,4,5") == 15 assert add("4\n3\n2,1") == 10
def test_sample(): assert add(3, 4) == 7
def test_addNumbers(): actual = add(-1, 1) assert actual == 0
def test_add_2(self): self.assertEqual(3, add(1, 2))
def test_add_nums(): actual = add(1, 10) assert actual == 11
import sample ret = sample.add(1, 2) print(ret) # 3 print(sample.PI) # 3.1415 print(sample.print_list([10, 20, 30])) # 10 # 20 # 30
def test_add_two(): assert 20 == add(0,20) assert 10 == add(10,0)
def test_add(self): result = sample.add(1, 5) self.assertEqual(result, 3)
def test_add(self): self.assertEqual(sample.add(1, 2), 3)
def test_add(): assert sample.add(4, 5) == 9
def test_minus(): assert sample.add(2, 3) == 5
def test_success_sample(self): self.assertEqual(add(1, 2), 3, msg='function add is invalid')
# Modules # Built in Modules # import random from random import choice as c, shuffle, randint li = ["apple", "orange", "mango", "cherry", "pineapple"] choice = c(li) print(choice) print(li) shuffle(li) print(li) print(randint(1, 100)) import datetime print(datetime.datetime.now()) print(type(datetime.datetime.now())) # Custom Modules # import modules # print(modules.add(4,5)) import sys sys.path.insert(1, 'abc/') import sample print(sample.add(4, 5))
def test_add_str(): assert add("a", "b") == "ab"
def test_add_strings(self): result = add('Hello,', ' World!') self.assertEquals('Hello, World!', result)
def test_add_list(): assert add([1], [2]) == [1, 2] raise Exception()
def test_add_num(): assert add(1, 2) == 3
def test_add_integers(self): result = add(3, 9) self.assertEquals(8, result)
def test_multiple_num(): assert add("1,2,3,4,5") == 15 assert add("1,1,1,1,1") == 5