gregmalcolm / python_koans

Python Koans - Learn Python through TDD
MIT License
4.95k stars 2.83k forks source link

AboutStrings: Unclear testing purpose #262

Open LizBroadbridge opened 2 years ago

LizBroadbridge commented 2 years ago

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.

v-aryan commented 1 year ago

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

v-aryan commented 1 year ago
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 ?

HeavenEvolved commented 1 year ago

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))