python_koans icon indicating copy to clipboard operation
python_koans copied to clipboard

AboutStrings: Unclear testing purpose

Open LizBroadbridge opened this issue 2 years ago • 3 comments

In the 'AboutStrings' test class there's a test called 'test_use_single_quotes_to_create_string_with_double_quotes'. I found it unclear what the purpose of this test was. It seemed like I had to rewrite the string out which didn't make much sense to me, since it meant I was comparing itself to itself. The same goes for the following test called 'test_use_double_quotes_to_create_strings_with_single_quotes'. I found the other questions useful, so if these two could be changed to match a similar pattern to the rest that would be great.

LizBroadbridge avatar Oct 16 '22 11:10 LizBroadbridge

Hey @LizBroadbridge , Can you explain this in much more simplified way, what has to be done !

v-aryan avatar Jan 30 '23 07:01 v-aryan

def test_use_single_quotes_to_create_string_with_double_quotes(self):
    string = 'He said, "Go Away."'
    self.assertEqual(__, string)

def test_use_double_quotes_to_create_strings_with_single_quotes(self):
    string = "Don't"
    self.assertEqual(__, string)

did you mean to merge both the strings under one ?

v-aryan avatar Jan 30 '23 07:01 v-aryan

I don't understand the issue, what you write is supposed to be equal to itself. Do you want to do something like the following?:

        a = 'He said, "Go Away"'
        b = """He said, "Go Away"""
        self.assertEqual(__, (a == b))

HeavenEvolved avatar Mar 16 '23 06:03 HeavenEvolved