示例#1
0
    def test_static_values(self):

        for input_path, output_path, (test_place, test_value) in zip(
                self.test_input, self.test_output, self.test_data_output):
            main(self.test_learning, input_path, output_path, sample=False)

            with open(output_path, 'r') as test_out:
                output = test_out.readline().split('\t')
                place, value = output[:2]

                self.assertTrue(test_place in place)
                self.assertAlmostEqual(test_value, float(value), places=3)
示例#2
0
 def test_part2(self):
     assert part2.main() == 58534
示例#3
0
 def test_zero(self):
     main(self.test_learning, 'test/5', 'test/5out', sample=False)
     with open('test/5out', 'r') as test_out:
         output = test_out.readline().split('\t')
         self.assertEqual(output, ['', '', ''])
示例#4
0
 def test_part2_scenario1(self):
     assert part2.main('./scratch2.txt') == 396
示例#5
0
## IMPORTANT: DO NOT EDIT THIS FILE ##

import part1
import part2
import part3

not_done = True
while not_done:
    trying = input("Which file would you like to run?\n")
    not_done = False
    if trying == "part1":
        part1.main()
    elif trying == "part2":
        part2.main()
    elif trying == "part3":
        part3.main()
    else:
        not_done = True
        print("Invalid file, please try again.")
示例#6
0
 def test_part2_scenario0(self):
     assert part2.main('./scratch.txt') == 26
示例#7
0
 def test_part2(self):
     assert part2.main() is None
示例#8
0
 def test_part2_scenario4(self):
     assert part2.main('./scratch2-4.txt') == 72
示例#9
0
 def test_part2_scenario3(self):
     assert part2.main('./scratch2-3.txt') == 32
示例#10
0
 def test_part2_scenario2(self):
     assert part2.main('./scratch2-2.txt') == 24
示例#11
0
 def test_part2_scenario3(self):
     assert part2.main('./scratch3.txt') == 5586022