brando90 / MathNet-large-scale-Mathematics-Dataset-for-Machine-Learning

1 stars 0 forks source link

Implement unit test that checks that latex_visualize is not set; Fix test that violated this. #83

Closed ghost closed 6 years ago

ghost commented 7 years ago

68

brando90 commented 7 years ago

That wasn't what I had in mind. Something like this:

    def runTest (self):
        # TODO how do I stop hardcoding the tests here, just go over your
        print()
        qagenerator = self.qa_constructor()
        #
        seed = 0 # random.randint()
        original_latex_flag = qagenerator.use_latex
        q_original,a_original = qagenerator.get_single_qa(seed=seed)
        # the latex flag should still be as original
        self.assertEqual(original_latex_flag,qagenerator.use_latex)
        #
        qagenerator.use_latex = True
        seed = 1 # random.randint()
        original_latex_flag = qagenerator.use_latex
        q_original,a_original = qagenerator.get_single_qa(seed=seed)
        # the latex flag should still be as original
        self.assertEqual(original_latex_flag,qagenerator.use_latex)
        #
        qagenerator.use_latex = False
        seed = 2 # random.randint()
        original_latex_flag = qagenerator.use_latex
        q_original,a_original = qagenerator.get_single_qa(seed=seed)
        # the latex flag should still be as original
        self.assertEqual(original_latex_flag,qagenerator.use_latex)
brando90 commented 7 years ago

@danharaj do we still need to do something? if not lets close this.

brando90 commented 7 years ago

the code is:

     def runTest (self):
          # TODO how do I stop hardcoding the tests here, just go over your
          print()
 -        qag = self.qa_constructor()
 -        seed = 0 # random.randint(0,500)
 +        qagenerator = self.qa_constructor()
 +        self.assertIsNone(qagenerator.latex_visualize)

I'm not sure if this is what I meant. I thought latex_visualize was suppose to be None or something...