def test_that_no_hashed_keywords_remain_in_fault(self): keywords = [ '#VERB', '#NOUN', '#ADJECTIVE', '#NAME', '#ADJECTIVE_MAYBE', '#AN', '#RANDOM', '#CAPITALISE', '#CAPALL' ] fault = s.getfault() for keyword in keywords: self.assertNotIn(keyword, fault)
def test_that_no_hashed_keywords_remain_in_fault(self): keywords = ['#VERB', '#NOUN', '#ADJECTIVE', '#NAME', '#ADJECTIVE_MAYBE', '#AN', '#RANDOM', '#CAPITALISE', '#CAPALL'] fault = s.getfault() for keyword in keywords: self.assertNotIn(keyword, fault)
def test_getfault_handles_it_when_we_submit_a_float(self): _number = 98.9 fault = s.getfault(_number) print(fault) self.assertIsInstance(fault, self.variable_types)
def test_getfault_returns_an_error_when_we_submit_a_negative_number(self): _number = -1 self.assertRaises(TypeError, (s.getfault(_number)))
def test_getfault_returns_an_error_when_we_submit_a_number_as_a_string(self): _string = '64' self.assertRaises(TypeError, (s.getfault(_string)))
def test_getfault_returns_an_error_when_we_submit_a_string(self): _string = 'hello my name is bob' self.assertRaises(TypeError, (s.getfault(_string)))
__author__ = 'morrolan' import platform import surrealism new_file = '/vagrant/results/large_output_{0}.txt'.format(platform.python_version()) with open(new_file, 'w') as _file: counter = 0 while counter <= 1000: s = surrealism.getsentence() _string = str(s) + "\n" _file.writelines(_string) counter += 1 _sep = "\n\n\n\n\n\n\n\n\n\n\n\n" _file.writelines(_sep) counter = 0 while counter <= 100: s = surrealism.getfault() _string = str(s) + "\n" _file.writelines(_string) counter += 1 _file.close() print("COMPLETE")
def test_get_fault_returns_an_error_when_we_submit_a_negative_number(self): _number = -1 self.assertRaises(TypeError, (s.getfault(_number)))
def test_getfault_returns_a_unicode_string_with_integer_upper_limit(self): limits = s.__gettablelimits__() upper_limit = limits['max_fau'] fault = s.getfault(upper_limit) self.assertIsInstance(fault, self.variable_types)
def test_getfault_returns_a_unicode_string(self): fault = s.getfault() self.assertIsInstance(fault, self.variable_types)
def test_getfault_with_a_random_integer(self): limits = s.__gettablelimits__() upper_fault_limit = limits['max_fau'] fau_id = random.randint(1, upper_fault_limit) fault = s.getfault(fau_id) self.assertIsInstance(fault, self.variable_types)
def test_getfault_returns_a_unicode_string_with_integer_lower_limit(self): lower_limit = 1 fault = s.getfault(lower_limit) self.assertIsInstance(fault, self.variable_types)
def test_get_fault_returns_an_error_when_we_submit_a_string(self): _string = 'hello my name is bob' self.assertRaises(TypeError, (s.getfault(_string)))
def test_get_fault_returns_an_error_when_we_submit_a_number_as_a_string( self): _string = '64' self.assertRaises(TypeError, (s.getfault(_string)))
import platform import surrealism new_file = '/vagrant/results/large_output_{0}.txt'.format( platform.python_version()) with open(new_file, 'w') as _file: counter = 0 while counter <= 1000: s = surrealism.getsentence() _string = str(s) + "\n" _file.writelines(_string) counter += 1 _sep = "\n\n\n\n\n\n\n\n\n\n\n\n" _file.writelines(_sep) counter = 0 while counter <= 100: s = surrealism.getfault() _string = str(s) + "\n" _file.writelines(_string) counter += 1 _file.close() print("\nLarge output test: COMPLETE\n")