def test_is_none_with_none(self): # Assure tested_value = None # Act result = StringUtil.is_none(tested_value) # Assert self.assertTrue(result)
def test_is_none_with_whitespaces(self): # Assure tested_value = ' ' # Act result = StringUtil.is_none(tested_value) # Assert self.assertTrue(result)
def test_is_none_with_something(self): # Assure tested_value = 'something' # Act result = StringUtil.is_none(tested_value) # Assert self.assertFalse(result)
def is_valid_json(params: str) -> bool: """ Checks, if given string is a valid JSON. """ if StringUtil.is_none(params) or params.strip() == '{}': return False try: json_object = json.loads(params) except ValueError as e: return False return True